note 18671 rejected from function.array-multisort by danbeck
| From: | danbeck@php.net | Date: | Wed, 13 Mar 2002 15:57:42 +0000 |
| Subject: | note 18671 rejected from function.array-multisort by danbeck | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-27741@lists.php.net to get a copy of this message | ||
if you have to sort a multidimensional array for example a mysql result try to make a normal sort on
it.
Its sorted by the first row.
the example from above:
$result = mysql_query("SELECT field1, field2 from table");
while ($rows[] = mysql_fetch_array($result)) {}
sort($rows);
//Now, $rows is sorted on field1
$result = mysql_query("SELECT field2, field1 from table");
while ($rows[] = mysql_fetch_array($result)) {}
sort($rows);
//Now, $rows should be sorted on field2