oliverj777 Posted July 4, 2011 Share Posted July 4, 2011 Hello, I have an online scoreboard, and right now it just displays all the players from highest score to lowest score. How would I be able to only display 20 players, and have a 'next' button that then displays the next 20 players down the line of scores? So, below is the code I use to display my score table: mysql_connect("localhost", "user", "pass"); mysql_select_db("data"); $fetch = "SELECT * FROM highscores ORDER BY score desc"; $result = mysql_query($fetch); $grab = $_POST["grabUser"]; $count = 1; while($row = mysql_fetch_array($result)){ echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"30\" align=\"left\" class=\"scoreBoard-content\">".$count."</td>"; echo "<td width=\"50%\" align=\"left\" class=\"scoreBoard-content\">".$row['player']."</td>"; echo "<td align=\"right\" class=\"scoreBoard-content\">".$row['score']."</td>"; echo "<td width=\"60\" align=\"right\" class=\"scoreBoard-content\">"; $count ++; } Link to comment https://forums.phpfreaks.com/topic/241091-display-20-results-every-page-sql/ Share on other sites More sharing options...
QuickOldCar Posted July 4, 2011 Share Posted July 4, 2011 It's called pagination, is a tutorial here. http://www.phpfreaks.com/tutorial/basic-pagination Link to comment https://forums.phpfreaks.com/topic/241091-display-20-results-every-page-sql/#findComment-1238338 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.