Sorting Multidimensional Array
am 31.10.2006 17:57:05 von Larentium
------=_NextPart_000_0737_01C6FCD2.EBD25680
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi,
RE: Sorting Multidimensional Array
I'm trying to sort a multidimensional array. The data was taken from
a mysql query:
$myrow =3D mysql_fetch_row($result) {
query[] =3D $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:
=20
$test =3D array_multisort($query, $key =3D '$query[4]');
Any help would be greatly appreciated. Thanks,
Larentium
------=_NextPart_000_0737_01C6FCD2.EBD25680--
Re: Sorting Multidimensional Array
am 01.11.2006 00:10:01 von Chris
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/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Sorting Multidimensional Array
am 01.11.2006 00:12:57 von Dave W
------=_Part_16966_25024728.1162336377190
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
You should be able to use usort()
On 10/31/06, 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,
>
>
> Larentium
>
>
--
Dave W
------=_Part_16966_25024728.1162336377190--