bqp2 Posted October 3, 2010 Share Posted October 3, 2010 <? session_start(); $query4 = "SELECT username,points FROM members WHERE won != 'yes' ORDER BY points DESC LIMIT 10"; $result4 = mysql_query($query4) or die(mysql_error()); $num=mysql_num_rows($result4); ?> <span style="float:left;"> <table width="200"> <tr><td colspan="2" align="center">TOP 10 USERS</td></tr> <tr><td align="left"><b>Username<b></td><td align="left"><b>Points</b></td></tr> <?php $i=0; if($num>0){ while ($i < $num) { $username6=mysql_result($result4,$i,"username"); $points6=mysql_result($result4,$i,"points"); $i++; echo "<tr><td>".$username6."</td><td>".$points6."</td></tr>"; } } ?> </table> </span> why is it reporting like this? timmy_73 - 83 shawn429 - 74 bobp - 74 bqp - 73 shelia - 44 joe23 - 219 jessica - 167 nicoleb -153 Skippylynn - 13 shawnb75 - 11 the 219, 167, and 153 should be at top Quote Link to comment https://forums.phpfreaks.com/topic/215028-mysql-not-putting-top-users-in-right-order/ Share on other sites More sharing options...
Jumpy09 Posted October 3, 2010 Share Posted October 3, 2010 Technically it's reporting them in the correct order by first number first, then second number, then third number. I've tested something like this and it seems to pull mine out fine. Are you sure the field you are using for points is an INT field? That's the only thing I can currently think of. Quote Link to comment https://forums.phpfreaks.com/topic/215028-mysql-not-putting-top-users-in-right-order/#findComment-1118495 Share on other sites More sharing options...
Pikachu2000 Posted October 3, 2010 Share Posted October 3, 2010 Give this a shot: $query4 = "SELECT username, points FROM members WHERE won != 'yes' ORDER BY ABS(`points`) DESC LIMIT 10"; Quote Link to comment https://forums.phpfreaks.com/topic/215028-mysql-not-putting-top-users-in-right-order/#findComment-1118578 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.