json encodes aray

Posted by Stan Forrest on Stack Overflow See other posts from Stack Overflow or by Stan Forrest
Published on 2010-05-28T16:17:05Z Indexed on 2010/05/28 16:42 UTC
Read the original article Hit count: 318

Filed under:
|
|

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

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql