note 82715 added to function.array-multisort
| From: | NoSpam at osu1 dot php dot net | Date: | Wed, 23 Apr 2008 10:02:10 +0000 |
| Subject: | note 82715 added to function.array-multisort | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-138681@lists.php.net to get a copy of this message | ||
To sort the array returned e.g. by oci_fetch_all you must divide it in seperate arrays.
Example:
<?php
$rows=oci_fetch_all($stmt,$results);
?>
now you have several arrays each named by the key name in the sql result.
E.g. array of names, array of streets, array of towns.
To sort the result by e.g. towns you would do the following:
<?php
array_multisort($results[towns],$results[names],$results[streets]);
?>
Done.
To display the result sorted by towns you could use this:
<?php
print_r(array("names"=>$results[names],"streets"=>$results[streets],
"towns"=>$result[towns]));
?>
----
Server IP: 208.69.120.35
Probable Submitter: 88.217.195.18
----
Manual Page -- http://www.php.net/manual/en/function.array-multisort.php
Edit -- https://master.php.net/note/edit/82715
Del: integrated -- https://master.php.net/note/delete/82715/integrated
Del: useless -- https://master.php.net/note/delete/82715/useless
Del: bad code -- https://master.php.net/note/delete/82715/bad+code
Del: spam -- https://master.php.net/note/delete/82715/spam
Del: non-english -- https://master.php.net/note/delete/82715/non-english
Del: in docs -- https://master.php.net/note/delete/82715/in+docs
Del: other reasons-- https://master.php.net/note/delete/82715
Reject -- https://master.php.net/note/reject/82715
Search -- https://master.php.net/manage/user-notes.php