Name

mysql_data_seek —

Synopsis

void mysql_data_seek(MYSQL_RES *res, unsigned int offset)

Moves to a specific row in a group of results. The first argument is the MYSQL_RES structure that contains the results. The second argument is the row number you wish to seek to, starting from 0. This function works only if the data was retrieved using mysql_store_result, because datasets retrieved with mysql_use_result are not guaranteed to be complete.

Example

/* Jump to the last row of the results */
mysql_data_seek(results, mysql_num_rows(results)-1);

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.