imperialized Posted February 23, 2009 Share Posted February 23, 2009 Ok, here is my problem.. I'm tryin to run a top 10 for a website I am working on, however, the display is incorrect. $top_10 = @mysql_query("SELECT * FROM poker_users ORDER BY chips DESC LIMIT 10"); while($x = mysql_fetch_array($top_10)) { $xname = $x['poker_name']; $chips_total = $x['chips']; print "<tr> <td width=75><b><a href=\"#\" onClick=\"ajax('content','profile.php?account=$xname')\">$xname</a></b> </td> <td>$chips_total </td>"; print "</tr>"; } Outputs this: Top 10 Players: David 997015289 CritEater 875 Chris 1767 XxCassi16xX 11700 Admin 102979237 David1 1000 TChip 1000 NickieJ 1000 Criswell 1000 david23 1000 Its obvious what the problem is.. I just don't know how to solve it.. Quote Link to comment https://forums.phpfreaks.com/topic/146471-solved-order-a-mysql-query-by-total/ Share on other sites More sharing options...
JoeBuntu Posted February 23, 2009 Share Posted February 23, 2009 looks like your chips field is a text data type in the database. It is sorting in text mode rather than numeric. Quote Link to comment https://forums.phpfreaks.com/topic/146471-solved-order-a-mysql-query-by-total/#findComment-768939 Share on other sites More sharing options...
imperialized Posted February 23, 2009 Author Share Posted February 23, 2009 That's exactly what it was, got it a hurry setting up the table. thanks Quote Link to comment https://forums.phpfreaks.com/topic/146471-solved-order-a-mysql-query-by-total/#findComment-769365 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.