Hi all!

i have to solve one problem, but i have no idea how to make this. I have
got a tree strucutre in mysql table, id - parent - name. I need make
function, which return array which will contains a strucutre of this
tree-menu, table example:

ID     Parent Name
------ ------ ----------------------
1      0      Components
4      1      Main boards
5      1      HD
7      5      IDE
8      5      SCSI

and result:

$array = Array(
        "id" => "1",
        "name" => "Components",
        "sub" => array(
                "id" => "4",
                "name" => "Mainboards",
                "sub" => no_array  (no sub pages)),
                array(
                "id" => "5",
                "name" => "HD",
                "sub" => Array(
                         "id" => "7",
                         "name" => "IDE",
                         "sub" => no_array  (no sub pages)),
                         Array(
                         "id" => "8",
                         "name" => "SCSI",
                         "sub" => no_array (no sub pages))
                )

);

an so on, source table has got about 300 items, so i need function which
make an array for next work with this tree structure.

thanks a lot for some help!

jiri.nemec at menea.cz
http://www.menea.cz
ICQ: 114651500


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to