Hello
I am using this solution found on stackoverflow to encode my MYSQL output to a JSON encoded array.
$sth = mysql_query("SELECT ...");
$rows = array();
while($r = mysql_fetch_assoc($sth)) {
$rows[] = $r;
}
print json_encode($rows);
This works great and produces an output of
[{"id":"81","title":"Something Here","start":"2009-10-27 09:00:00"},{"id":"77","title":"Report on water","start":"2009-10-30 09:00:00"}]
Now I need to put a value of say
"colour":"Blue"
within the JSON encoded array.
So i need the ouput to look like
[{"id":"81","title":"Community Awareness","start":"2009-10-27 09:00:00", "colour":"Blue"},{"id":"77","title":"Write a 10,000 Page Report on Emma","start":"2009-10-30 09:00:00", "colour":"Blue"}]
Does anyone have any solutions on how I could achieve this?
Thanks,
Tim Mohr