|ADOdb Library for PHP Manual|
|Prev|| Implementing Scrolling with
Next and Previous
The following code creates a very simple recordset pager, where you can scroll from page to page of a recordset.
$db = NewADOConnection('mysql');
$sql = "select * from adoxyz ";
$pager = new ADODB_Pager($db,$sql);
This will create a basic record pager that looks like this:
The number of rows to display at one time is controled by the Render($rows) method. If you do not pass any value to Render(), ADODB_Pager will default to 10 records per page.
You can control the column titles by modifying your SQL (supported by most databases):
= 'select id as "ID",
firstname as "First Name", lastname as "Last Name", created as "Date Created"
The above code can be found in the adodb/tests/testpaging.php example included with this release, and the class ADODB_Pager in adodb/adodb-pager.inc.php. The ADODB_Pager code can be adapted by a programmer so that the text links can be replaced by images, and the dull white background be replaced with more interesting colors.
You can also allow display of html by setting $pager->htmlSpecialChars = false.
Some of the code used here was contributed by Iván Oliva and Cornel G.
|Generating Update and Insert SQL||Up||Exporting in CSV or Tab-Delimited Format|