Name

mysql_num_rows —

Synopsis

int mysql_num_rows(MYSQL_RES *result)

Returns the number of rows of data in the result set. This function is accurate only if the result set was retrieved with mysql_store_result. If mysql_use_result was used, the value returned by this function is the number of rows accessed so far.

Example

/* 'results' is a MYSQL_RES result set structure */
num_rows = mysql_num_rows(results);
printf("There were %d rows returned, that I know about\n", num_rows);

Get Managing & Using MySQL, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.