Counting total number of rows in resultset using php and mysql

To count total number of rows in resultset using php and mysql is quite easy just to use mysql_num_rows() function, this function takes resultset as a parameter and then tell us how much rows resultset have. Let's look below the code to see its demonstration

$sql="select * from users where username='Micheal' AND password='123456'";
$resultset=mysql_query($sql);
$total=mysql_num_rows($resultset);
echo $total;


So this is the way to find out total number of rows in resultset using php and mysql.

0 comments: