PDA

View Full Version : enumerated links


tylerh
06-23-2008, 07:50 PM
hi

how would i do this.. like page number links on each page and << back and next >> based on which page the person is on

like if i was on a page like this
http://codingforums.com/page.php?id=5

and there was 20 page ids (from 1-20) how would i get 20 a previous link then the 20 links to page.php?id=1 page.php?id=2 and so on + the previous page link

BWiz
06-23-2008, 08:22 PM
You could achieve this by using databases. You would have to somehow point to all the pages in the database, each one with their id (1, 2, 3 et cetera), and then send a query to retrieve these pages, however with a LIMIT (say 5).

Then you can have a link to the next five. So for example your query string would be something like page.php?id=2, and your query would look something like this:


SELECT `title`
FROM `pages`
LIMIT 5, 5
The LIMIT 5, 5 the first 5 will cause the query to start from the fifth entry, and the second 5 will limit the query to five results, so results 6, 7, 8, 9 and 10 will be shown.

whizard
06-24-2008, 02:15 AM
there is a "pagination" snippet in the PHP snippets section of this forum which you may be interested in.

ohgod
06-24-2008, 03:29 PM
i've used the pagination class from http://phpsense.com/php/php-pagination-script.html and it works very well