PHPmysql_num_rows () function definition and instance usage display

Source: Internet
Author: User
PHPmysql_num_rows () function definition and usage description definition and usage the number of rows in the result set returned by the mysql_num_rows () function. Syntax mysql_num_rows (data) parameter description: required for data. Result set. This result set is obtained from the call of mysql_query. Description: PHP mysql_num_rows () function definition and usage

Definition and usage

The number of rows in the returned result set by the mysql_num_rows () function.

Syntax

mysql_num_rows(data)

Parameter description:

Data is required. Result set. This result set is obtained from the call of mysql_query.

Description

Mysql_num_rows () returns the number of rows in the result set. This command is only valid for SELECT statements. To obtain the number of rows affected by INSERT, UPDATE, or DELETE queries, use mysql_affected_rows ().

Tips and comments

Note: If mysql_unbuffered_query () is used, the correct value can be returned until all rows in the result set are extracted.

Note: If you use the data results queried by 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

 

The output is similar:

3

Instance 2:

Use the mysql_num_rows () function to obtain the number of records in the result set.

    
     
 Sorry, the information you want to query does not exist.

";}Do {// do... while loop?>

The above is the detailed description of PHP mysql_num_rows () function definition and instance usage Display. For more information, see other related articles in the first PHP community!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.