Ifaiden Posted March 31, 2010 Share Posted March 31, 2010 I've just managed to get my paging function to work. Here's how it works: From mysql's "LIMIT $X,$Y", X is the starter and Y is the limit, and the limit is a constant digit. For example: If I define the limit as $Y=2 and $X=0 only two rows will appear and its the first two rows. And if there is 10rows in total, it will display the paging as 1, 2, 3, 4, 5. --- My problem is, if there are like over 10 000 rows it will display from 1, 2, 3, 4...etc to 5000 in in the paging. I want it to display just like in this forum. like this: 1, 2, 3, 4, [...], 5000. (the closest three pages of the current page, and the last page) Another example. If 10is the current page: 7, 8, 9, 10, 11, 12, 13, [...], 5000 --- Any idea how to make this work? (sorry for the poor explanation) Link to comment https://forums.phpfreaks.com/topic/197148-paging-problems/ Share on other sites More sharing options...
Ifaiden Posted March 31, 2010 Author Share Posted March 31, 2010 Or a tutorial to google's paging function would be nice Link to comment https://forums.phpfreaks.com/topic/197148-paging-problems/#findComment-1034846 Share on other sites More sharing options...
irkevin Posted March 31, 2010 Share Posted March 31, 2010 Try visiting this link I got a similar problem also. Which was fixed by the code in this topic http://www.phpfreaks.com/forums/index.php/topic,154528.msg668929.html#msg668929 Link to comment https://forums.phpfreaks.com/topic/197148-paging-problems/#findComment-1034855 Share on other sites More sharing options...
Ifaiden Posted April 1, 2010 Author Share Posted April 1, 2010 Oh thanks... but I still can't get it to work, please help me, here's my code: echo "Number News:" .$nume. "<br>"; echo "Start:" .$eu. "<br>"; echo "Limit:" .$limit. "<br>"; echo "Page:" .$page. "<br>----<br>"; $l=1; $i=0; for($i=0; $i < $nume; $i=$i+$limit){ if($i <> $eu ){ echo "<a href='$page_name&start=$i&limit=$limit'><font face='Verdana' size='2'> $l</font></a> "; } else { echo "<font face='Verdana' size='4' color=red>$l</font>"; //The current page is red } $l++; } And this displays: Number News: 22 Start: 0 Limit: 2 Page: 1 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 --- I want it to look like this: 1, 2, 3, [...], 11 Link to comment https://forums.phpfreaks.com/topic/197148-paging-problems/#findComment-1035264 Share on other sites More sharing options...
Ifaiden Posted April 1, 2010 Author Share Posted April 1, 2010 Changed the code a little bit, still won't work. Can someone please help? $l=1; $i=0; $how_much_before = 2; $how_much_after = 2; for($i= 0; $i < $nume; $i=$i+$limit){ if($page == $l){ //The current site is not displayed as a link and is highlighted with the color red echo "<font face='Verdana' size='4' color=red>$l</font>"; } else { echo "<a href='$page_name&start=$i&limit=$limit'><font face='Verdana' size='2'> $l</font></a> "; } $l++; } Link to comment https://forums.phpfreaks.com/topic/197148-paging-problems/#findComment-1035407 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.