10bet网址
MySQL 5.6 C API Developer Guide
Download this Manual

5.4.48 mysql_num_rows()

my_ulonglong mysql_num_rows(MYSQL_RES *result)

Description

Returns the number of rows in the result set.

The use ofmysql_num_rows()depends on whether you usemysql_store_result()ormysql_use_result()to return the result set. If you usemysql_store_result(),mysql_num_rows()may be called immediately. If you usemysql_use_result(),mysql_num_rows()does not return the correct value until all the rows in the result set have been retrieved.

mysql_num_rows()is intended for use with statements that return a result set, such asSELECT. For statements such asINSERT,UPDATE, orDELETE, the number of affected rows can be obtained withmysql_affected_rows().

Return Values

The number of rows in the result set.

Errors

None.