Home>Article>Backend Development> PHP mysql_num_rows() function definition and example usage display
PHP mysql_num_rows() function definition and usage introduction
Definition and usage
mysql_num_rows() function returns the number of rows in the result set.
Syntax
mysql_num_rows(data)
Parameter description:
data Required. Result set. This result set is obtained from a call to mysql_query().
Description
mysql_num_rows() returns the number of rows in the result set. This command is only valid for SELECT statements. To get the number of rows affected by an INSERT, UPDATE, or DELETE query, use mysql_affected_rows().
Tips and Notes
Note: If you use mysql_unbuffered_query(), mysql_num_rows() cannot return the correct value until all rows in the result set have been fetched.
Note: For data results queried using the mysql_unbuffered_query() function, you cannot use the mysql_num_rows() function to obtain the number of records in the query result set.
Example
Output is similar:
3
Example 2:
Use the mysql_num_rows() function to get the number of records in the result set
对不起,你要查询的信息不存在"; } do { //do...while 循环 ?>
The above is the detailed content of PHP mysql_num_rows() function definition and example usage display. For more information, please follow other related articles on the PHP Chinese website!