ciao!
ho due query e quello che devo fare č costruire un array come quello che vi mostro sotto. Date le due query, riuscite ad aiutarmi per favore?
La prima query estrae l'elenco di tutti i padri:
select id, father_name from table where is_father='1'
e la seconda mostra l'elecno dei figli dato il padre
SELECT id, child_name FROM table where father_id='{father_id}'
L'array che devo creare č questo:
$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'
)
)
);
grazie!