COUNT how many times "live" is in a column
Posted: Thu Sep 17, 2009 5:43 am
Hi
I have a simple query but cannot recall how to do this.
I need to count how many "live" there are in a table. ie. if 50 people have sent in something, and we have made 20 'live', STATUS has "live" entered into it. I need to see how many "live" there are.
I have a simple query but cannot recall how to do this.
Code: Select all
include "dbconn.php";
$result = mysql_query ("SELECT status, COUNT(status) as num_of FROM usercomments WHERE status = 'live'");
while ($row = mysql_fetch_array($result)){
echo "Live comments" .$row['num_of'];
}
mysql_free_result($result);