I tried to push a new array value to JSON
$var=array("code"=>"100");
$sql = SELECT order as orderID, pub as orderCode from cart
while ($row = mysql_fetch_assoc ($sql) {
$var[] = $row;
}
echo '{"status":'. json_encode($var).'}';
I want push this string to the JSON array above
$string = array("total"=>"3000");
and my script displays like this:
{
"status":{
"code":"100",
"0":{
"total":"3000"
},
"1":{
"orderID":"16",
"orderCode":"14290290685322"
},
"2":{
"total":"3000"
}
}
}
and I want var total inside like this:
**////////blablabla
"1":{
"orderID":"16",
"orderCode":"14290290685322",
"total":"3000"
}
*///blablba