How do I order the results of my query?
So if you have a list of first names, you will often want to order them alphabetically and not in the jumbled format that they come out of the database. So here's how to do it:
<?php
$atozofnames = mysql_query("SELECT firstname FROM names ORDER BY firstname");
?>
Comment on this Question and Answer >>>
ASK A QUESTION
More mysql PHP Questions
What is difference between mysql_fetch_array and mysql_fetch_object?How do I find the number of rows in a result set?
How do I limit the number of rows returned?
How do I include a conditional in my mysql query?
How do I access the current time with mysql?
