hahaitwork Posted November 27, 2012 Share Posted November 27, 2012 Hello, I need the script to be able to only pick the 50 best scores, and not every score that is submitted. Any idea? It has to be the 50 best of course, not just randomly 50. Is it something that can be fixed with > or is it abit more advance code? <html> <head> <link href="styleofc.css" rel="stylesheet" type="text/css"> </head> <center> <div style="position:absolute; margin-left:450px; margin-top:0px; TOP:100px; color:#D8D8D8;" border="2" > <?php $con = mysql_connect("loff-production.com.mysql","loff_production","v4rANidp"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("loff_production", $con); $result = mysql_query("SELECT name, score FROM high_scores_avoidthecars ORDER BY score DESC"); echo "<table border='20'> <tr> <th>Name</th> <th>Score</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" .'           '. $row['name'] .'        '. "</td>"; echo "<td>" .'           '. $row['score'] .'        '. "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?> </div> </center> </html> Quote Link to comment https://forums.phpfreaks.com/topic/271239-1-50-table-database-sorting/ Share on other sites More sharing options...
Muddy_Funster Posted November 27, 2012 Share Posted November 27, 2012 least you got the code tags this time You really should be learing SQL, this is seriuosly basic stuff. SELECT name, score FROM high_scores_avoidthecars ORDER BY score DESC LIMIT 50 Quote Link to comment https://forums.phpfreaks.com/topic/271239-1-50-table-database-sorting/#findComment-1395481 Share on other sites More sharing options...
hahaitwork Posted November 27, 2012 Author Share Posted November 27, 2012 least you got the code tags this time You really should be learing SQL, this is seriuosly basic stuff. SELECT name, score FROM high_scores_avoidthecars ORDER BY score DESC LIMIT 50 Thanks and yeah, I'm rarily using this stuff but it sure would be handy to know it. Quote Link to comment https://forums.phpfreaks.com/topic/271239-1-50-table-database-sorting/#findComment-1395491 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.