PHP Questions Home

Categories

Arrays
Files
Forms
Functions
Images
MySQL
Numbers
Others
Strings
Website


PHP Functions

PHP Functions


More PHP

Top Questions
Ask a Question

How do I order the results of my query?


To order the results, use the ORDER BY wording.

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");
?>



More mysql PHP Questions

How do I find second highest value from a table?
How do I return a random row from the database?
How do I insert the date into my table?
How do I return the date with mySQL?
How do I include a conditional in my mysql query?