You can call the mysql_num_rows() function to return the number of rows in a result set.
Syntax
my_ulonglong
mysql_num_rows(MYSQL_RES *result)
Return values
The number of rows in the result set is returned.
Errors
None.
Notes
If you use mysql_store_result(), mysql_num_rows() may be called immediately. If you use mysql_use_result(), mysql_num_rows() returns the correct number of rows only after all the rows in the result set have been retrieved.
mysql_num_rows() is used in statements that return a result set, such as SELECT. For statements such as INSERT, UPDATE, or DELETE, the number of affected rows can be obtained by using mysql_affected_rows().