You can call the mysql_stmt_data_seek() function to search for an arbitrary row in the result set of a statement.
Syntax
void
mysql_stmt_data_seek(MYSQL_STMT *stmt,
my_ulonglong offset)
The offset value is a row number and should range from 0 to mysql_stmt_num_rows(stmt)-1.
Return values
None.
Errors
None.
Notes
This function requires that the result set structure contain the entire result of the last executed query. In this way, mysql_stmt_data_seek() may be used only together with mysql_stmt_store_result().