Array... Parent IDs...
| From: | Michael Smith | Date: | Tue, 08 Apr 2003 06:31:08 +0000 |
| Subject: | Array... Parent IDs... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-142808@lists.php.net to get a copy of this message | ||
Hi,
So I have an array:
$_tmpArray:
Array
(
[2] => Array
(
[parent_id] => 1
)
[3] => Array
(
[parent_id] => 3
)
)
Of course it is much, much larger, and has some more values, however,
that's not important. I'm trying to figure out a way to group these into
arrays based upon their parent_id. I want all the ones with a parent_id
of 1 in an array called $pid1 (or it could be $pid[1], that would be
fine) and all with a parent_id of two in another array, etc. I'm trying
to figure out exactly how to do this... I need to be able to create a
tree based on the parent_ids (in HTML)... is there a way to do this? I'm
using similar code to get it from the database as phpLayersMenu, and
they print it as javascript, but the order doesn't matter...
-Michael
--
Michael Smith <msmith@custom87.net>
Custom87.net