man12_patil3 Posted November 27, 2008 Share Posted November 27, 2008 php is new lang. for me. i have 2000 record which is dispaly on web page(10 record each page) by pagination. but problem is that i get 200 links of pages on webpage which take large space. I want to display it in a grop of 10-10 pages. where is the code for it. can anybudy help me ?? Thx Link to comment https://forums.phpfreaks.com/topic/134498-pagination-by-10-10-page-link/ Share on other sites More sharing options...
spaze Posted January 5, 2009 Share Posted January 5, 2009 For the first link, put parameters the each link as follows: show.php?min=1&max=10 show.php?min=11&max=20 show.php?min=21&max=30 show.php?min=31&max=40 show.php?min=41&max=50 Then in your script, when you fetch the data from the database or text file, ignore all that comes before min and after max values and show the not-ignored values on your website. This means each time you click on a link it makes a new data query. Link to comment https://forums.phpfreaks.com/topic/134498-pagination-by-10-10-page-link/#findComment-729852 Share on other sites More sharing options...
svivian Posted February 9, 2009 Share Posted February 9, 2009 ^ You don't need two parameters for each URL, you should do something like: show.php?page=1 show.php?page=2 ...etc Then, with a bit of maths, calculate which records you need for each page on that. Something like: $perpage = 10; $page = $_GET['page']; $min = ($page-1)*10; $max = $min + $perpage; That will give you min=0, max=10 for page 1; min=10, max=20 for page 2. Then simply use those numbers in your MySQL query, in the "limit" clause. Something like: $sql = "SELECT * FROM mytable LIMIT $min, $max"; Link to comment https://forums.phpfreaks.com/topic/134498-pagination-by-10-10-page-link/#findComment-757797 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.