title: How to use avg function?
body: <p>I'm new at php and mysql stuff and i'm trying to use an avg function but i don't know how to.</p>
  
  <p>I'm trying to do something like this:</p>
  
  <pre><code>mysql_connect(localhost,$username,$password);
  
  @mysql_select_db($database) or die ("Did not connect to $database");
  
  mysql_query("AVG(column1) FROM table1 ") or die(mysql_error());
  
  mysql_close();
  
  echo AVG(column1);
  </code></pre>
  
  <p>(Q1)I'd like to see the value printed in the screen, but i'm getting nothing but an error message. How could I print this average on the screen ? </p>
  
  <p>(Q2)If I had a column month in my table1, how could I print the averages by the months ?</p>
  
  <p>Sorry for any bad English, and thanks for the attention. </p>