The next logical function to discuss is mysql_num_rows(). This function returns the number of rows retrieved by a SELECT query, taking the query result as a parameter.
$num = mysql_num_rows($result);
I’ll use this function in two different ways. First, I’ll modify view_users.php to list the total number of registered users. Second, I’ll modify register.php to test if an email address has already been taken before letting a user register with it.
Open view_users.php (refer to Script 7.4) in your text editor.
Before the if ($result) conditional, add this line (Script 7.6)
$num = mysql_num_rows ($result);
Script 7.6. Now the view_users.php script will display the total number of registered ...