Hello,
i've got a SQL query which returns multiple rows, and i have :
$data = array(
"nom" => $row['nom'] ,
"prix" => $row['rapport'],
"average" => "$moyenne_ge"
);
which is perfect, but only if my query returns one row.
i tried that :
$data = array();
$data[$row['nom']]["nom"] = $row['nom'] ;
...
$data[$row['nom']]['average'] = "$moyenne_ge";
in order to have :
$data[brand1][nom] = brand1
$data[brand1][average] = 150$
$data[brand2][nom] = brand2
$data[brand2][average] = 20$
...
but when i do : json_encode($data)
i only have the latest JSON object instead of all JSON object from my request as if my array has only one brand instead of 10.
I guess i did something stupid somewhere. Thanks for your help