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
>
To: "Keith Spiller" <[EMAIL PROTECTED]>
Cc:
Sent: Tuesday, October 31, 2006 10:48 AM
Subject: Re: [PHP] Sorting Multidimensional Array
On Tue, October 31, 2006 11:10 am, Keith Spiller wrote:
RE: Sorting Multidimensional Array
I'm trying to sort a multidimensional array.
On Tue, October 31, 2006 11:10 am, Keith Spiller wrote:
> 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 an
> > I'd like to sort the array based on one of the values in the field
> > href, description, or time. Is there a canonical way of doing this?
you might be able to use http://us2.php.net/manual/en/function.usort.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://
> I'd like to sort the array based on one of the values in the field
> href, description, or time. Is there a canonical way of doing this?
Probably easiest to write your own sort function the use usort(),
http://www.php.net/usort has pretty good documentation on how to
accomplish this.
Steve
--
http://ca3.php.net/manual/en/function.array-multisort.php
this might do it.
Jason
Chris Lott <[EMAIL PROTECTED]> wrote:
>
> I have an array $links like this:
>
> [1] => Array
> (
> [href] => http://www.poetrymagazine.org/epstein_sept_prose.html
> [description]
I have an array $links like this:
[1] => Array
(
[href] => http://www.poetrymagazine.org/epstein_sept_prose.html
[description] => Thank You, No
[time] => 2004-09-17T17:30:32Z
)
[2] => Array
(
[href] => http://110am.com/projec
I have a 2 dimensional array...with the second dimension having
12 elements. What I want to do is sort (and re-sort) they array
by one of the 12 elements...keeping data consistent.
All of the examples I have read @php.net seem to deal with
multidim-arrays that only have one element in them.
H
8 matches
Mail list logo