title: PHP/MYSQL echo totals counts from query
body: <p>I have run a query using COUNT(id) as a way to sum up the number of rows with a given id.  I now want to print that number.  Since there are many ids, I need to print it many times.  I think each pageid/count(id) is its own row of the table but maybe I am wrong.  Here is the gist of the code (apologies for using mysql_query):</p>
  
  <pre><code>$sql = "SELECT pageid, COUNT(id) FROM views 
  GROUP BY pageid 
  ORDER BY COUNT(id)"
  
  $res = mysql_query($sql);
  while($row = mysql_fetch_array($res)) {
    echo $row['pageid'];
    echo $row['count(id)'];
  }
  </code></pre>
  
  <p>except the last line is not working.</p>
  
  <p>Thanks for help!</p>