It seems that I would hop through hoops to move data from MySQL to json via PHP json_encode - take care of the encoding, pull the related data from the database and make sure you have an array inside the array inside the array (snapshot below) ... is is it a json framework or something where you feed its sql using join tables and it does all the redundant / confusing work for you?
function people_list() {
$data['jdata'] =
array(
'groups' =>
array(
array(
'name' => 'DeveloperList',
'people' => array(
array('name' => 'sam sneed'),
array('name' => 'sue summer')
)
),
array(
'name' => 'PMList',
'people' => array(
array('name' => 'tim pm'),
array('name' => 'sara pm')
)
),
array(
'name' => 'ClientList',
'people' => array(
array('name' => 'Mr Smith'),
array('name' => 'Ms Jones')
)
)
)
);
$this->load->view('json', $data);
}
meade source
share