Documentation Home
MySQL 5.7 C API Developer Guide
Download this Manual
PDF (US Ltr) - 1.1Mb
PDF (A4) - 1.1Mb


5.4.49 mysql_num_rows()

my_ulonglongmysql_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.