Prøv dette:
list($count) = mysql_fetch_row(mysql_query("select count(*) from `test`"));
echo $count;
Alternativt, hvis du allerede kører en forespørgsel for at få nogle kommentarer, kan du prøve dette:
$sql = mysql_query("select sql_calc_found_rows * from `test` order by `id` desc limit 10");
// ^ Get the 10 most recent comments
list($count) = mysql_fetch_row(mysql_query("select found_rows()"));
// this avoids having to run the entire query again, great for efficiency!
while($comment = mysql_fetch_assoc($sql)) var_dump($comment); // just an example