Re: how to use Pager on an sql (Page pagination)

From: Date: Mon, 12 Jul 2004 13:20:45 +0000
Subject: Re: how to use Pager on an sql (Page pagination)
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-13656@lists.php.net to get a copy of this message
On Mon, 12 Jul 2004 14:42:24 +0800, Louie Miranda wrote: > i got most of it, im not familiar on how can i display the > $pagerData? I have tried.. to pass it via.. > > while ($pageData->fetchInto($row)) { > . > } > > But error like "Call to a member function on a non-object" is > showing up. $pageData is an array, not a resultset: foreach ($pageData as $row) { //do sth } Also note that if you use Pager to paginate the results of a SQL query, you may want to use a wrapper to LIMIT your query beforehand, to keep required resources to a minimum. You can see a possible implementation of such a wrapper here: http://seagull.phpkitchen.com/docs/wakka.php?wakka=PagingRecordsets I'll add it to the official documentation too. HTH Regards, -- Lorenzo Alberton http://pear.php.net/user/quipo >> //After your query, take the result and pass it through a pager >> object; >> >> $pager = &new Pager($params); >> $pageData = $pager->getPageData(); >> $pagerLinks = $pager->getLinks(); >> >> Now $pagerData contains the result of the query and $pagerLinks >> contains the links for the navigation. Notice that $params is a >> variable. Its an array of paramters for pager. >> >> > -- > Louie Miranda > http://www.axishift.com

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