Name
mysql_field_seek —
Synopsis
MYSQL_FIELD_OFFSET mysql_field_seek(MYSQL_RES *result, MYSQL_ FIELD_OFFSET offset)
Moves
the internal pointer of a result set to the given field of the
current row. The position set by this function is used when
mysql_fetch_field
is called. The
MYSQL_FIELD_OFFSET
value passed should be the
return value of a mysql_field_tell
call (or
another mysql_field_seek
). If the value passed is
0, the function seeks to the beginning of the row. The return value
is the position of the cursor before the function was called.
Example
MYSQL_FIELD field; /* result is a MYSQL_RES structure containing a result set */ /* ... do some stuff */ /* Seek back to the beginning of the row */ old_pos = mysql_field_seek(results, 0); /* Fetch the first field of the row */ field = mysql_fetch_field(results); /* Go back to where you were */ mysql_field_seek(results, old_pos);
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.