I count MySQL rows using this function:
function sqlcount($table)
{
$sql = mysql_query("SELECT COUNT(0) FROM $table;");
$sql = mysql_fetch_array($sql);
return $sql[0];
}
Print the result:
echo sqlcount("members");
But this does not work and does not show the true count. What is the problem?
COUNT(0)
Makes No Sense, UseCOUNT(*)
. – N.B. Jan 24 '12 at 12:36