manix Posted July 18, 2011 Share Posted July 18, 2011 I'm creating a simple pagination where it's supposed to show me 10 records per page from the database and in order to do that I'm using the LIMIT function but it's not working right It's working for the fist page tho, here's the code: // FIRST PAGE $query = "SELECT id, header, story, datetime, author, reported, comments FROM stories WHERE `type`='1' ORDER BY id DESC"; $result = mysql_query($query." LIMIT 0,10"); while($row = mysql_fetch_assoc($result)) { ... $pages=2; // just for temp testing for ($i=1; $i<=$pages; $i++){ $result = mysql_query($query." LIMIT ".($i*10).",".($i*10+10)); while($row = mysql_fetch_assoc($result)) { and it's working but it's showing me 12 or 13 or even more records on the second page ... why ? omg I just checked the syntax and realized what input 2 is ... >.< sorry for the spam Link to comment https://forums.phpfreaks.com/topic/242259-limit/ Share on other sites More sharing options...
srikanth03565 Posted July 18, 2011 Share Posted July 18, 2011 Looks like there is a issue in your pagination logic itself.Check limit values in second page.. Link to comment https://forums.phpfreaks.com/topic/242259-limit/#findComment-1244162 Share on other sites More sharing options...
manix Posted July 18, 2011 Author Share Posted July 18, 2011 yeah it's Limit(start,number of records) I thought it was LIMIT(start,end) .... >.< Link to comment https://forums.phpfreaks.com/topic/242259-limit/#findComment-1244163 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.