Pager versus DB_Pager - which to use?

From: Date: Fri, 31 Dec 2004 14:51:48 +0000
Subject: Pager versus DB_Pager - which to use?
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-16539@lists.php.net to get a copy of this message
After reading replies to earlier question, I researched Pager in PEAR. There's a PAGER and a DB_PAGER. PAGER is more recent. Which do you recommend using? Thanks. Matthew Weier O'Phinney <matthew@garden.org> wrote: * l Burnerheimerton : > Below is some code. I need to add apging to this page since it could > list many items. > > $res =& $db->query("SELECT ID, fName FROM names WHERE ID = 1 > if (DB::isError($res)) { > die($res->getMessage()); > } > > while($row =& $res->fetchRow()) { > echo "$row[1]"; > } > > > Any ideas or code or links to read are much appreciated! First off, you're going to need to use limits in your sql statements. Then, you're going to need to have some code that determines what page you're on in order to determine the offset for your limit. If you look at the PEAR::Pager docs, I think you'll get the idea. This stuff is simply not as trivial as a one line change to your script -- but it is possible and relatively easy. -- Matthew Weier O'Phinney | mailto:matthew@garden.org Webmaster and IT Specialist | http://www.garden.org National Gardening Association | http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org -- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --------------------------------- Do you Yahoo!? Take Yahoo! Mail with you! Get it on your mobile phone.

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