from my coding experience, the aggregate function COUNT and mysql_num_rows both return number of rows.
example,
Both $num_of_rows_1 and $num_of_rows_2 return same number.PHP Code:
$query = mysql_query("SELECT COUNT(*) as num_rows FROM sample_table");
$row = mysql_fetch_array($query);
$num_of_rows_1 = $row['num_rows'];
$query = mysql_query("SELECT * FROM sample_table");
$num_of_rows_2 = mysql_num_rows($query);
If COUNT() and mysql_num_rows are the same, which do you think is more efficient, faster?








Bookmarks