Re: Pager - help with trying to work with Pager with DB results set
| From: | Justin Patrin | Date: | Wed, 16 Nov 2005 21:50:21 +0000 |
| Subject: | Re: Pager - help with trying to work with Pager with DB results set | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-21948@lists.php.net to get a copy of this message | ||
On 11/16/05, l Burnerheimerton <lburnerheimerton@yahoo.com> wrote:
>
> require_once("DB.php");
> require_once("Pager/Pager.php");
> ...
> $resultset =& $db->query("...");
>
> $params = array(
> 'itemData' => $res,
> 'perPage' => 10,
> 'delta' => 8,
> 'append' => true,
> 'clearIfVoid' => false,
> 'urlVar' => 'entrant',
> 'useSessions' => true,
> 'closeSession' => true,
> 'mode' => 'Jumping'
> );
> $pager = & Pager::factory($params);
> $data = $pager->getPageData();
> $links = $pager->getLinks();
> echo $links['all'];
> echo $pager->linkTags;
> echo 'PAGED DATA: ' ; print_r($data);
>
>
> I want to print the data in a table. I have that set
> up now looping through $row, "while($row =&
> $resultset->fetchRow())"
>
> Do I collect all the html in a variable then send that
> as $data?
>
> Thanks for any help or example links.
>
Look at the examples for Pager. It has a DB example. If you want to
output paged data from your DB I recommend Structures_DataGrid.
--
Justin Patrin