Re: [Pager] Pager_Wrapper_DB...and so on
| From: | Matthew Weier O'Phinney | Date: | Tue, 02 Nov 2004 15:35:01 +0000 |
| Subject: | Re: [Pager] Pager_Wrapper_DB...and so on | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-15296@lists.php.net to get a copy of this message | ||
* Mos <mos_fr@yahoo.fr>:
> I found that I can use Pager to obtain a pretty good pagination when
> extracting data from a DB.
> That is fine.
> I guess that with large tables, with lots records I should use a wrapper to
> extract only needed records.
> Lorenzo Alberton suggest a Pager_Wrapper_DB function to deal with that.
> (http://seagull.phpkitchen.com/docs/wakka.php?wakka=PagingRecordsets and
>
> http://cvs.php.net/co.php/pear/Pager/examples/Pager_Wrapper.php)
I don't know that you need a wrapper, per se. If you know the number of
records, and the current page and number per page, Pager can return the
offset. You can then pass the offset and limit to the SQL you're using
to pull the records. I personally feel this is simple enough to
implement without mucking about with wrappers.
> 2/ How many records means "large table" and "lot of records" ?
Depends on how many fields you have in your table, and how much data is
held per field. That said, I usually paginate at 15-25 records.
--
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