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

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