More Questions Than Answers

Dan Atrill's blog site

Get first record in mysql recordset

This solved a problem the other day whereby mysql_fetch_array had already been used after a query had been run. The first record in the set didn’t appear. Doing the same query in Webmin produced the first record. Using mysql_data_seek(-result-,-recordnumber-) will move the pointer to the correct first record.
This could be useful for looping through records from a particular place – ie running a query but starting the results at somewhere other than the first record such as paging through a search, though this can also be done using LIMIT (-startpoint-, -number of records to return-)
For some more info see: PHP mysql_data_seek() Function on W3School’s site.

Fri, January 11 2008 » PHP

Leave a Reply

*