'Select name from table order by name asc'
"asc" grows, it will give you a text field in alphabetical order, on the contrary, "desc" will give it to you in reverse alphabetical order.
Edit: Generally, you should allow the database to sort. The next post is related, and perhaps almost the same. You may find it helpful:
PHP / SQL: ORDER BY or sort ($ array)?
karim79
source share