I have an Xbox Live API and I offer people the ability to generate a gamer profile, on generation there gamertag gets added to a mysql database, and then when the profile link is visited, the api updates all t he information and the gamerscore is fetched and then an sql query is ran to update the gamerscore for that gamertag in the database, this is so I can create an Xbox Live leaderboard.
The problem is when it comes to displaying the results on a leaderboard page I use ORDER BY DESC to order the gamerscores (and gamertags) in order by the highest gamerscore, but it don't seem to work, it orders them, but in the wrong way, I have even tried ORDER BY gamerscore ASC, but it makes no difference, although I know it should be ORDER BY gamerscore DESC, heres the code;
<?php // Query to select data from table $query = "SELECT * FROM leaders ORDER BY gamerscore DESC"; $result = mysql_query($query); // Check if we are able to select data from table if (!$result) { echo "Unable to fetch any gamers, there maybe a problem with the database."; } else { while($row = mysql_fetch_array($result)): ?> <table width="100%" border="1" cellspacing="0" cellpadding="0"> <tr> <td width="81%"><a href="profile.php?gamertag=<?php echo $row['gamertag']; ?>&format=html"><?php echo $row['gamertag']; ?></a></td> <td width="14%"><?php echo $row['gamerscore']; ?></td> </tr> </table> <?php endwhile ?> <?php } ?>
Does anyone know where I'm going wrong with this.
Thank you in advance (and yes I know, its messy )