PHP Questions Home | Register | Login
Categories
Arrays
Files
Forms
Creating PDFs
PHP Errors
Functions
Images
MySQL
Numbers
Others
Strings
Website
Unanswered

PHP Forums
Forums Index
MySQL Forum
PHP Forum
Flash/Actionscript
Javascript
Web design

More PHP
PHP Functions
Top Questions
Ask a Question
PHP Interview Questions
PHP Jobs
Ecommerce
IT Questions
Business Websites

Sponsors

sponsor ad
My Salary
PHP Developer Salary
Advertise Here

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



Comment on this Question and Answer >>>

ASK A QUESTION

More mysql PHP Questions

How do I find second highest value from a table?

Equip table and Vendor table. Each piece of equipment has a matching vendor ID. How to display vendor name instead of ID in PHP output?

How do I return the date with mySQL?

How do I set a default value for ENUM fields in PHP?

I have a database with a table and in the table I have a row named php_code and I want to print the code of this row in my site as script. Example in row: and in my site: hello.



Custom Search