I have coded to display single array fetching from database. I want to display multiple array values as shown in below
{"newrelease" : [{"model" : "apple 6", "image": " photo.jpg" , "specs": ""}] }
I have coded $response['New Releases' ][]['Model'][$b['PhoneModel']] =$b['FileName'];
which gives output as {"New Releases":[{"Model":{"desire-x":"_htc-desire-x-dual-sim.jpg"}}
Add a new array
to your newrelease
array
like this
$response['newrelease'][] = array(
'model' => $b['PhoneModel'],
'image' => $b['FileName'],
'specs' => ""
);
echo json_encode($response);
This here should do the trick i think:
$response['newrelease'][] = array("model" => "apple 6", "image" => " photo.jpg" , "specs" => "");