# \[PHP\] ORDER BY mySQL problem

**URL:** <https://forum.kirupa.com/t/php-order-by-mysql-problem/173868>\
**Category:** programming\
**Created:** [December 30, 2005, 12:30pm UTC](https://forum.kirupa.com/t/php-order-by-mysql-problem/173868 "2005-12-30T12:30:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sofajoe](https://avatars.discourse-cdn.com/v4/letter/s/e99b99/32.png) [@sofajoe](https://forum.kirupa.com/u/sofajoe)\
**Post date:** [December 30, 2005, 12:30pm UTC](https://forum.kirupa.com/t/php-order-by-mysql-problem/173868/1 "2005-12-30T12:30:42Z")

</div>

OK, i have made the user name, scores and time to be recorded into a MySQL table and i have managed to have this data sent back to my swf - but it is showing the lowest score at the top - how to switch it and make the highest take the number 1 postition?

here’s my code:  
$sql = “SELECT \* FROM $table\_name ORDER BY total”;  
$result=mysql\_query($sql, $db);

this works - but i tried adding DESC  
$sql = “SELECT \* FROM $table\_name ORDER BY total DESC”;  
$result=mysql\_query($sql, $db);

and this makes it not work!  
any suggestions?
