sybase_data_seek

(PHP 3, PHP 4, PHP 5)

sybase_data_seek -- Moves internal row pointer

Description

bool sybase_data_seek ( resource result_identifier, int row_number )

如果成功则返回 TRUE,失败则返回 FALSE

sybase_data_seek() moves the internal row pointer of the Sybase result associated with the specified result identifier to pointer to the specified row number. The next call to sybase_fetch_row() would return that row.

See also sybase_fetch_row().


add a note add a note User Contributed Notes
mark at somewhere dot com
16-Nov-2004 04:54
Make sure you have a data to seek, else you will get a bad row offset warning.
verdy_p at wanadoo dot fr
25-Jul-1999 05:33
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.