It returns number of rows in result
MySQL Table – Users
+—-+——+
| id | name |
+—-+——+
| 1 | PHP |
| 2 | PHP |
| 3 | PHP |
| 4 | PHP |
| 5 | PHP |
Example
<?php
mysql_connect(“localhost”, “root”, “phpcode”) or die(mysql_error());
$db_selected = mysql_select_db(“database_name”);
echo mysql_num_rows(mysql_query( “SELECT * FROM users”));
mysql_close();
?>
Output
5