Re: Sorting Multidimensional Array

From: Date: Tue, 31 Oct 2006 23:10:01 +0000
Subject: Re: Sorting Multidimensional Array
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-42624@lists.php.net to get a copy of this message
Keith Spiller wrote:
Hi, RE: Sorting Multidimensional Array I'm trying to sort a multidimensional array. The data was taken from a mysql query: $myrow = mysql_fetch_row($result) { query[] = $myrow; } The purpose is to retrieve the table data and manually add a record, then sort ASC by the startdate which is the forth field... Something like: $test = array_multisort($query, $key = '$query[4]'); Any help would be greatly appreciated. Thanks,
Is there a reason you want to do this in php rather than through the database itself? Through the database, just add: order by fieldname asc; to the end of the query. If you can't do it that way for whatever reason, post some sample data and what you want to get out of it. -- Postgresql & php tutorials http://www.designmagick.com/

« previous php.db (#42624) next »