smithmr8 Posted March 3, 2009 Share Posted March 3, 2009 Howdy, I'm trying to implement some form of page system into a list. Currently, the list is drawing information from a table and listing it. I would like to be able to list this data on different pages, to make it easier on the eyes aswell as when there is alot of information being listed. I've gotten part of the way there... $numcrnt = $numcurrent / 10; $pages = ceil($numcrnt); echo "<b>Page</b> "; for ($i = 1; $i <= $pages; $i++){ echo $i." "; } $numcurrent is the number of rows within the table which will be listed on the page. They are listed in order of their ID number, which is an auto_number allocated via the DB. The numbers won't necessarily be in sequential order. I want 10 items per page, maximum. This piece of code is providing me with the correct number of pages which I will need for the current list. I'm just stuck as how to do it. I was thinking that each number would link to the page: ticket.php?step=current&start=X X being 10 multiplied by the page number. Then I was thinking I would select only items (X-9) to X from the table using a mysql query. So, if it were page 3, it would be start=30 (3*10) and it would select items 21 to 30 from the table using a query. Only, I'm not too sure on how to do this. Would greatly appreciate any help. Regards, Luke Quote Link to comment https://forums.phpfreaks.com/topic/147784-implementing-pages-into-a-list/ Share on other sites More sharing options...
Philip Posted March 3, 2009 Share Posted March 3, 2009 A great tutorial on our site about pagination: http://www.phpfreaks.com/tutorial/basic-pagination Quote Link to comment https://forums.phpfreaks.com/topic/147784-implementing-pages-into-a-list/#findComment-775731 Share on other sites More sharing options...
smithmr8 Posted March 3, 2009 Author Share Posted March 3, 2009 Just the thing. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/147784-implementing-pages-into-a-list/#findComment-775740 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.