Menu
Hi!
I have 2 query
The first show father list:
select id, father_name from sitetree where ShowInMenus=’1′
and this show for each father, his children:
SELECT id, child_name FROM sitetree where ParentID='{father_id}’
I neww build an array like this..
$data = array(
$father_id_1 => array(
‘name’ => ‘Father_1’,
‘children’ => array(
$child_id_1_1 => ‘Child_1_1’,
$child_id_1_2 => ‘Child_1_2’
)
),
$father_id_2 => array(
‘name’ => ‘Father_2’,
‘children’ => array(
$child_id_2_1 => ‘Child_2_1’,
$child_id_2_2 => ‘Child_2_2’
)
)
);
can yuo help me create php code to build this array?thanks!