RE: [PHP] About PHP/MYSQL Pagination
| From: | Sanjeev N | Date: | Sat, 04 Aug 2007 15:43:12 +0000 |
| Subject: | RE: [PHP] About PHP/MYSQL Pagination | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-260182@lists.php.net to get a copy of this message | ||
Hi,
1. first you know current page number
2. you know how many pages
Next consider total how many page number you want to display Assume 5
I.e. <<
first previous | 1 2 3 4 5 | next last >>
Now when you come to page 4 then starting page is around 4-1 or 4-2 (however
you want) and start the for loop till 4+2 or 4+3(depends on you).
I.e. first previous | (4-2) (4-1) 4 (4+1) (4+2) (4+3) | next last >>
For loop will be
For(i=-2; i<=2; i++)
Echo <a href="">$pagenumber+$i</a>;
I think you got some idea
Warm Regards,
Sanjeev
http://www.sanchanworld.com/
http://webdirectory.sanchanworld.com
-----Original Message-----
From: Kelvin Park [mailto:kelvinpark86@gmail.com]
Sent: Friday, August 03, 2007 6:43 AM
To: php-general@lists.php.net
Subject: [PHP] About PHP/MYSQL Pagination
I just couldn't find it anywhere, google or yahoo. I know how to make
first, previous, last, and next links for php/mysql pagination. How do
you list page numbers in the middle, between previous and next? (ex. <<
first previous | 1 2 3 4 5 | next last >> )
I know how to display them from 1 to whatever by using for loop, but the
problem comes in when I click "next" from page "5", it does not get
re-listed starting from page "6".
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php