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

Last updated 6 years, 2 months ago | 1841 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;