I want to know how to add dynamic key/value pair in an Json array of objects during execution.
$result2 is from database query results
while( $row = mysql_fetch_assoc($result2) )
{
$result_show[]=$row;
$result_show[]['ismy']='1';
$result_show[]['time']='close';
$result_show[]['img'] = $path;
}
My Result is:
{"results":[{"id":"412"},{"ismy":"0"},{"time":"close"},{"img":"1.JPG"}]}
Desired Result is:
{"results":[{"id":"412","ismy":"0","time":"close","img":"1.JPG"}]}
Whats wrong with this? Please help me out.