json encodes aray
- by Stan Forrest
Okay I have been struggling with this for hours. What I am doing is creating array of what I call objects that can be moved around on a calendar.
Below is my code
$year = date('Y');
$month = date('m');
echo json_encode(array(
array(
'id' => 111,
'title' => "Event3",
'start' => "$year-$month-10",
'url' => "http://domain.com/"
),
array(
'id' => 222,
'title' => "Event2",
'start' => "$year-$month-20",
'end' => "$year-$month-22",
'url' => "http://domain.com/"
)
));
Now here is my problem. I need to loop through a mysql database to retrieve the information for each object. For some reason I can't get this to work. Please help
Thanks
Stan