How can we find the number of rows in a result set using PHP?

Last updated 5 years, 7 months ago | 1286 views 75     5

Tags:- PHP PHP-MySQL

PHP | Find the number of rows in a result set

Bellow code is use for the same

$sql = "SELECT * FROM table1";
$result = mysql_query($sql, $db_link);
$num_rows = mysql_num_rows($result);
echo $num_rows;