zampu Posted June 25, 2007 Share Posted June 25, 2007 Hello, ive made a script to order the players in my game by money, and its not working. Please help <?php session_start(); include_once "includes/db_connect.php"; include_once "includes/functions.php"; logincheck(); print "<tr valign='top'><td width=25%>"; print "</td>"; print "<td width=100%>"; //main table $getscores="SELECT money,username from users ORDER BY money ASC limit 25"; $getscores2=mysql_query($getscores) or die("Could not get scores"); $rank=1; print "<center><h3>Top 25 players</h3></center><center>"; print "<table width=90% class='maintable'><tr><td>Rank</td><td>Name</td><td>NetWorth</td></tr>"; while($getscores3=mysql_fetch_array($getscores2)) { $getscores3[username]=strip_tags($getscores3[username]); print "<tr><td>$rank</td><td>$getscores3[username]</td><td>$$getscores3[money]</td></tr>"; $rank++; } print "</table></center><br><br>"; ?> Its getting all of the info, and making the table, and listing it. Its just not ordering it by "money" Quote Link to comment Share on other sites More sharing options...
btherl Posted June 25, 2007 Share Posted June 25, 2007 What data type is money? Try this: ORDER BY CAST(money AS UNSIGNED) Quote Link to comment Share on other sites More sharing options...
zampu Posted June 25, 2007 Author Share Posted June 25, 2007 Yes! it worked but it orders them backwards lol, how would i do this for DESC? Quote Link to comment Share on other sites More sharing options...
btherl Posted June 25, 2007 Share Posted June 25, 2007 ORDER BY CAST(money AS UNSIGNED) DESC Quote Link to comment Share on other sites More sharing options...
zampu Posted June 25, 2007 Author Share Posted June 25, 2007 *ambarased face* Thanks, i really appreciate it! 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.