Membership
Main Menu
Forum Boards
Stats
- 18 tutorials
- 72,301 members
- 696,007 forum posts
- 11 blog posts
Tutorials
PHP Basic Pagination
by Crayon Violent on Jun 18, 2008 6:11:55 PM
Views: 45349
When you click on one of the page navigation links, the target page is passed through the URL via the GET method. So here we want to grab the target page number. We want to first check to see if it's even there and if it is number, because if this is the first time someone loads the page, it won't be set. Or someone could manually change the value in the URL.
If it is there and it is numeric, we are going to force it to be type int. What this means is if someone were to change the page number in the URL to like 9.75, it will truncate it to 9, because there's no such thing as page 9.75 unless you're Harry Potter.
If the value fails to be set or is not numeric, we default to page 1.
Comments
1. Ben Smithers on Jun 19, 2008 8:47:14 AM
2. Rezert on Jun 20, 2008 8:48:44 AM
3. Crayon Violent on Jun 20, 2008 10:35:51 AM
4. Rodney Moore on Jun 20, 2008 3:45:30 PM
5. Rezert on Jun 20, 2008 7:38:02 PM
6. norwid on Jun 22, 2008 1:50:14 PM
7. Crayon Violent on Jun 22, 2008 4:48:14 PM
8. Christopher Burnside on Jun 24, 2008 7:07:35 AM
9. webent on Jul 3, 2008 4:08:16 PM
10. petitchevalroux on Aug 1, 2008 8:02:26 AM
11. vherhonne on Aug 2, 2008 12:40:41 PM
12. GreenUser on Aug 15, 2008 3:19:29 PM
13. tmallen on Sep 1, 2008 8:50:48 PM
14. Fluoresce on Sep 16, 2008 3:36:32 PM
15. Crayon Violent on Sep 17, 2008 5:34:48 PM
16. biciodark on Oct 14, 2008 8:20:25 PM
17. hakmir on Oct 16, 2008 5:52:14 PM
18. Crayon Violent on Oct 16, 2008 6:28:17 PM
19. Kayosz on Oct 27, 2008 10:19:05 AM
20. Crayon Violent on Oct 27, 2008 11:02:34 AM
21. yepwingtim on Oct 31, 2008 7:35:49 PM
22. yepwingtim on Nov 1, 2008 3:15:23 AM
23. Crayon Violent on Nov 2, 2008 1:37:43 AM
Login or register to post a comment.
