Page 1 of 1
How to Sort Resource Type Like $result=mysql_query()
Posted: Tue Mar 23, 2010 4:57 am
by abhiraj60
Can we sort a resource type in php
eg: $result=mysql_query("select * from table");
Is there any way to sort the resultset in $result instead of doing it in the query directly.
Re: How to Sort Resource Type Like $result=mysql_query()
Posted: Tue Mar 23, 2010 5:17 am
by shafiq2626
Hi!
you can sort your query by Asc and Desc like
Code: Select all
mysql_query("select * from table order by date Asc or Desc")
please check it
Re: How to Sort Resource Type Like $result=mysql_query()
Posted: Tue Mar 23, 2010 11:54 am
by flying_circus
abhiraj60 wrote:Can we sort a resource type in php
eg: $result=mysql_query("select * from table");
Is there any way to sort the resultset in $result instead of doing it in the query directly.
You can drop the results to an array and then sort the array. Though, you'll take a performance hit over a SQL solution.