Re: Pager - some wishes ...

From: Date: Fri, 05 Mar 2004 12:27:16 +0000
Subject: Re: Pager - some wishes ...
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-11106@lists.php.net to get a copy of this message
Hallo Daniel Kopp, Daniel Kopp wrote: > -I just found out that there is an undocumented package > called DB_Pager. How can I find out how to use it? There > is not even an example ... Check the Pager.php itself. /** * This class handles all the stuff needed for displaying paginated results * from a database query of Pear DB, in a very easy way. * Documentation and examples of use, can be found in: * http://vulcanonet.com/soft/pager/ (could be outdated) * * IMPORTANT! * Since PEAR DB already support native row limit (more fast and avaible in * all the drivers), there is no more need to use $pager->build() or * the $pager->fetch*() methods. * * Usage example: * *< ?php * require_once 'DB/Pager.php'; * $db = DB::connect('your DSN string'); * $from = 0; // The row to start to fetch from (you might want to get this * // param from the $_GET array * $limit = 10; // The number of results per page * $maxpages = 10; // The number of pages for displaying in the pager (optional) * $res = $db->limitQuery($sql, $from, $limit); * $nrows = 0; // Alternative you could use $res->numRows() * while ($row = $res->fetchrow()) { * // XXX code for building the page here * $nrows++; * } * $data = DB_Pager::getData($from, $limit, $nrows, $maxpages); * // XXX code for building the pager here * ? > * * @version 0.7 * @author Tomas V.V.Cox <cox@idecnet.com> * @see http://vulcanonet.com/soft/pager/ */ -- mit freundlichen Grüßen ------------------------------------------------------------ IT Future AG Markus Tacker Bockenheimer Ldstr. 45 Mediengestalter 60325 Frankfurt / Main ---------------------------- E-Mail: mtacker@itfuture.de Telefon: 069 - 719163 0 Jabber: m@tacker.dyndns.org Telefax: 069 - 719163 13 ICQ: 9170 9561 ------------------------------------------------------------

« previous php.pear.general (#11106) next »