[an error occurred while processing this directive]

php MySQL order by clause:


In SQL generally we use three clauses, select ,from, and where.  There are many more clauses are present in SQL which are used for different purpose. Order by is one of the important clause of SQL. Order by clause is used to sort a particular field in either ascending order or descending order.

General Format of SQL is as follows:

select <list of fields to be displayed or * for displaying all fields>

from <table name>

where <condition if any>

order by <field name> <asc-for ascending order, it is default order or desc-for descending order>






die("Can not establish connection".mysql_error());



$result=mysql_query("select * from student order by name asc");



echo $row['age'];

echo" ".$row['name'];





28 rahul
28 shantanu
27 vikash
26 vinay


[an error occurred while processing this directive]