ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:addons:addons_index

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
v5:addons:addons_index [2016/02/02 01:38] – [The xmlrpc library] mnewnhamv5:addons:addons_index [2023/05/12 19:05] – [Paging & Scrolling with ADOdb Pager] updated, replaced text output with screenshot and added warning about XSS dregad
Line 177: Line 177:
 ------------------------------ ------------------------------
 ===== The xmlrpc library ====== ===== The xmlrpc library ======
-This addon provides an interface between the adodb recordset and the php xmlrpc library. [[v5:addons:xmlrpc|More Information]].+This addon provides an interface between the adodb recordset and the php xmlrpc library. [[v5:addons:xmlrpc|More Information]] 
 +----------------------------- 
 +<WRAP right box> 
 +== Requires == 
 +  adodb-pager.inc.php 
 +</WRAP>   
 +===== Paging & Scrolling with ADOdb Pager ===== 
 + 
 +The following code snippet creates a very simple pager, allowing you to navigate from page to page of a recordset. 
 + 
 +<code php> 
 +include_once 'adodb/adodb.inc.php'; 
 +include_once 'adodb/adodb-pager.inc.php'; 
 + 
 +$db = ADONewConnection('mysqli'); 
 +$db->connect('localhost', 'user', 'password', 'adodb'); 
 + 
 +$sql = 'select * from adoxyz'; 
 + 
 +$pager = new ADODB_Pager($db, $sql); 
 +$pager->render(5); 
 +</code> 
 + 
 +{{:v5:addons:adodb_pager_sample_output.png|Sample output from ADODB_Pager}} 
 + 
 +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(), the Pager will default to 10 records per page. 
 + 
 +You can control the column titles by aliasing them in your SQL (supported by most databases): 
 +<code php> 
 +$sql = 'select id as "ID",  
 +       firstname as "First Name",  
 +       lastname as "Last Name",  
 +       created as "Date Created"  
 +       from adoxyz'; 
 +</code> 
 +                  
 +The ADODB_Pager code can be adapted by a programmer to improve the layout, e.g. replacing the text links by images, and the dull white background by more interesting colors. 
 + 
 +By default, special characters in the displayed data will be escaped to prevent execution of HTML code. If you wish to have them interpreted instead, before calling Render() you can set 
 +<code php> 
 +  $pager->htmlSpecialChars = false; 
 +</code> 
 + 
 +<WRAP important> 
 +This is a **security risk**, unescaped HTML will leave you vulnerable to Cross-site scripting (XSS) attacks. 
 +Use with caution, and only with trusted data. 
 +</WRAP> 
v5/addons/addons_index.txt · Last modified: 2023/05/12 19:12 by dregad