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.
How to Sort Resource Type Like $result=mysql_query()
Moderator: General Moderators
-
shafiq2626
- Forum Commoner
- Posts: 88
- Joined: Wed Mar 04, 2009 1:54 am
- Location: Lahore
- Contact:
Re: How to Sort Resource Type Like $result=mysql_query()
Hi!
you can sort your query by Asc and Desc like
please check it
you can sort your query by Asc and Desc like
Code: Select all
mysql_query("select * from table order by date Asc or Desc")- flying_circus
- Forum Regular
- Posts: 732
- Joined: Wed Mar 05, 2008 10:23 pm
- Location: Sunriver, OR
Re: How to Sort Resource Type Like $result=mysql_query()
You can drop the results to an array and then sort the array. Though, you'll take a performance hit over a SQL solution.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.