Coba ini:
list($count) = mysql_fetch_row(mysql_query("select count(*) from `test`"));
echo $count;
Atau, jika Anda sudah menjalankan kueri untuk mendapatkan beberapa komentar, Anda dapat mencoba ini:
$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