How do i make this array?

Rate this:
By jokerz (Contact - View My Woyano)
Published Sun 04 Mar 2007, 352 Views, 2 Comments

can you help me?
How do i make result like this with ezsql?

$DATA = array("element"=>
                    array(
                        array("name"=> "test1","element" =>
                            array(
                                    array("name"  => "test1.1"),
                                    array("name"  => "test1.2","element" => array(
                                            array("name"  => "test1.2.1"),
                                            array("name"  => "test1.2.2")
                                        )
                                    )
                            )
                        )
                    )
                );


i try to make function like this


function categories($category=0,$level=0)  {
                global $db;
                $query  =  $db->get_results("SELECT dfno,name FROM tree_curr WHERE sfno='$category'");
                $level--;
                foreach(query  as $row){
                        $data .= $row;
                        if($level > 0){
                            categories($row['dfno'],$level);
                        }
                }
                return $data;
        }
       
echo (categories('0000001','2'));

But its fail........
Please can you help me, so i can get that array with deeper level i define in the function
Thanx before


This Item
Category: Knowledge, Questions, General
Tags: ezsql questions
Share it
Link to this item:
Bookmark this item: RSS Feed

People who liked this item

..

    2 Comments

  1.  
    JV ~ 16 months ago
    0 votes thumbs up thumbs down
    Why do you want to make an array with that structure, what is your reason for doing it?

    (It always helps if you tell your 'problem' not your 'solution')
    [ reply ]
    1.  
      jokerz ~ 16 months ago
      0 votes thumbs up thumbs down
      I want to make tree structure of my organization.
      And also i want to make tree menu from my static page.
      [ reply ]
      1.  
        22 votes thumbs up thumbs down
        This is my two cents...

           
        Hey you know AdGuy always gets the last word! ;)

      Please Login to Add Your Comment   ..or..  

      Replying to comment by