Sorting data in a MySQL query

Drop down lists or tables listing data are generally sorted. They could be sorted by PHP after downloading (or even by JavaScript dynamically) but the most effective way is to let the server do it. Just add an extra bit to any SELECT query. Add this to your mysqldropdown.php to sort the results:

$cdquery="SELECT cdTitle FROM firsttable ORDER BY cdTitle ASC";            
        

The ASC says sort ascending. DESC is the alternative so try it.

submit to reddit Delicious Tweet