You can call the mysql_stmt_num_rows() function to return the number of rows in a result set.
Syntax
my_ulonglong
mysql_stmt_num_rows(MYSQL_STMT *stmt)
Return values
The number of rows in the result set is returned.
Errors
None.
Notes
The use of mysql_stmt_num_rows() depends on whether mysql_stmt_store_result() is used to buffer the entire result set in the statement handler. If mysql_stmt_store_result() is used, mysql_stmt_num_rows() may be directly called. Otherwise, the row count is unavailable unless the rows are counted when being fetched.
mysql_stmt_num_rows() is used for statements that return a result set, such as SELECT. For statements such as INSERT, UPDATE, or DELETE, the number of affected rows can be obtained by using mysql_stmt_affected_rows().