whiteboikyle Posted June 16, 2008 Share Posted June 16, 2008 Okay well i am going to be making a members page but i want it to have page numbers. The thing is how do i limit display 20 members per page.. For example on first page will show 1-20 members the second page will show 21-40 members third page will show 41-60 members etc I know its something like $query = "SELECT * FROM members ORDER BY id desc limit 20"; EDIT: i just noticed i posted in wrong place you can delete this if you want! Quote Link to comment Share on other sites More sharing options...
trq Posted June 16, 2008 Share Posted June 16, 2008 This is the right place, while your sql query will be involved in the process its more a php issue. You'll want to google for a tutorial on php record pagination. Quote Link to comment Share on other sites More sharing options...
whiteboikyle Posted June 16, 2008 Author Share Posted June 16, 2008 Well the way i was thinking of doing it is like this. Page 1 would have the url members.php?viewlow=1&viewhigh=20 This would display 1-20 Page would have the url members.php?viewlow=21?viewhigh=40 this would display 21-40 and it could somehow use this in the sql like $_GET['viewlow'] , $_GET['viewhigh'] so SELECT * FROM members ORDER BY id desc limit $_GET['viewpage'], $_GET['viewhigh'] Is there anyway possible like that? Quote Link to comment Share on other sites More sharing options...
whiteboikyle Posted June 16, 2008 Author Share Posted June 16, 2008 After a little hard work and talking to friends online i figured it out <?php include("header.inc"); if(isset($_GET['page'])) { $page = $_GET['page']; if(is_numeric($_GET['page'])) { $number = member_start($page); $result = $config->query("SELECT * FROM members ORDER BY id desc limit $number,20"); while( $row = mysql_fetch_array($result) ) { echo("<a href='http://www.corpaluploads.com/".$row['username']."'>".$row['username']."</a><br>"); } } else { echo "Only Numeric Data May Be Entered!"; } } else { $number = member_start(1); $result = $config->query("SELECT * FROM members ORDER BY id desc limit $number,20"); while( $row = mysql_fetch_array($result) ) { echo("<a href='http://www.corpaluploads.com/".$row['username']."'>".$row['username']."</a><br>"); } } include("footer.inc"); ?> But now i am working on page numbers on the bottom I am going to make a function that counts all the members.. Then after that i need to do a page numbers by consecutive of 20. So if its 20 members or less it needs to be page 1 if its 20-40 members in need to be page 1, 2 but i just gotta think hard about this 1. If you know an easier way or can help me at all let me know Quote Link to comment 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.