Moves internal row pointer
(PHP 4, PHP 5)
Code Examples / Notes » sybase_data_seek
Use this function to skip rows in an ordered selection, for example to display only a limited ranges of rows in an HTML page, with "previous" and "next" submission buttons for the navigation. The row number may be stored in a hidden form entry or in the URL associated to the navigation links if you do not want to display forms in your page. This current row number will be submitted back to give the user the option to display other entries from the database.
However, avoid using this function to move randomly in a query result set. Note also that specifying a large number of rows to skip may be a performance issue, because the Sybase client in PHP3 will have to fetch many rows prior to find the requested row. An alternate solution is to use queries which return an ordered unique ID with each row returned, so that queries will use more efficient SQL to retrieve data rows in a BETWEEN condition in the WHERE clause, minimizing the impact of unnecessary fetched rows. Such access methods give much more productive results because it has a lower impact on the SQL server which will return small result sets.
A good way to minimize the impact of this function is to give the user the option to select more specific data with additional search fields, and forbid queries that return too many queries. You may also configure your PHP3 script so that it will limit the number of rows returned instead of providing "previous" and "next" navigation controls. Finally you may give the user an option to specify the number of rows he wants to display, and fix a limit on the specified number, so that no user will be able to display more data than this hardcoded limit in your PHP3 script.
Make sure you have a data to seek, else you will get a bad row offset warning.