mysql_fetch_rowmysql_fetch_row
|
This function takes the result structure we obtained from store result, and retrieves a single row from it, returning the data in a row structure that it allocates for you. When there is no more data, or an error occurs, NULL is returned. We will come back to processing the data in this row structure later.
mysql_data_seek
|
Thisfunction allows you to jump about in the result set, setting the row that will be returned by the next fetch row operation. The offset value is a row number, and must be in the range zero to one less than the number of rows in the result set. Passing zero will cause the first row to be returned on the next call to mysql_fetch_row.
my_sql_row_tell, mysql_row_seek
|
This function returns an offset value, indicating the current position in the result set. It is not a row number, and you can't use it with mysql_data_seek. However you can use it with:
|
which moves the current position in the result set, and returns the previous position.
This pair of functions can sometimes be useful for jumping between known points in the result set. Be careful never to mix up the offset value used by row tell and row seek with the row number used by data_seek. These are not interchangeable, and your results will not be what you were hoping for.
mysql_free_result
There is one last function we need to know before we can use these new functions in anger, and that is mysql_free_result.
|
When you've finished with a result set you must always call this function, to allow the MySQL library to tidy up the objects it has allocated.
View Executing SQL statements in MySQL databases using C Discussion
Page: 1 2 3 4 5 Next Page: Retrieving the data