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

Last updated 7 years, 1 month ago | 2344 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;