Home>Article>Backend Development> PHP mysql_num_rows() function definition and example usage display

PHP mysql_num_rows() function definition and example usage display

巴扎黑
巴扎黑 Original
2017-05-26 16:12:46 2716browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn