Membership
Main Menu
Forum Boards
Stats
- 18 tutorials
- 72,298 members
- 695,971 forum posts
- 11 blog posts
Tutorials
PHP Basic Pagination
by Crayon Violent on Jun 18, 2008 6:11:55 PM
Views: 45339
Just a couple of lines of code to connect to your database, obviously.
We need to find out how many rows are in the table so we can figure out how many pages we are going to have. So we do a basic count(*) query and assign that number to $numrows.
$rowsperpage is where we decide how many rows per page we want to have. To find out the total pages we will have, we take the number of rows ($numbrows) and divide that by the rows per page ($rowsperpage). Since there's no such thing as a half a page (unless your dog chews it up), we will round up, using ceil().
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.
