You are here: Re: [PHP] Pagination « PHP « IT news, forums, messages
Re: [PHP] Pagination

Posted by Matthew Weier O'Phinney on 03/27/05 04:20

* Pavel <pavel@ogi.cz>:
>> I am wanting to paginate records from a MySQL Database.
>> I want there to be 5 records on a page, on multiple pages.
>
> example for selecting page of records from mysql table:
> $sql=sprintf("
> SELECT SQL_CALC_FOUND_ROWS * FROM table LIMIT %d, %d",
> $position*$records,
> $records
> );
>
> after get count of all records:
> $sql='SELECT FOUND_ROWS()';
>
>> (I would like there to be a "next" and "previous.")
>
> you can use http://pear.php.net/package/Pager

+1 PEAR::Pager

In the examples/ directory of the Pager class is a wrapper class for
doing pagination from DB results; this will answer the OP's question.

--
Matthew Weier O'Phinney | WEBSITES:
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org
mailto:matthew@garden.org | http://vermontbotanical.org

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация