Hi Folks,
I get this response:
Expected ',' instead of ''
When I doing return $response->withJson($my_array_data, 200);
But, IF i turn $my_array_data into simple array structure, i get normal good json response. Example:
return $response->withJson(['resp' => ['attr_one' => 'value one', 'long_long_long_long_fieldname' => 'good value']], 200);
Then today I use dirty way to produce json response . echo json_encode($array); exit(0);
$app->get('/acak-rt/{phoneId}', function ($request, $response, $args) {
$q_srv_phone = $this->db->createQueryBuilder()
->select('p.survei_daftar_desa_id')
->from('survei_phone', 'p')
->where('p.master_phone_id = :phoneId')
->setParameter(':phoneId', $args['phoneId'])
->execute();
$srv_phone = $q_srv_phone->fetch();
$q_acak_rt = $this->db->createQueryBuilder()
->select(
'rt.survei_acak_rt_id',
'rt.survei_daftar_desa_id',
'rt.sigma',
'rt.nilai_acak',
'rt.terpilih'
)
->from('survei_acak_rt', 'rt')
->where('rt.survei_daftar_desa_id = :desaId')
->orderBy('rt.survei_acak_rt_id', 'ASC')
->setParameter(':desaId', $srv_phone['survei_daftar_desa_id'])
->execute();
$acak_rt = $q_acak_rt->fetchAll();
echo json_encode($acak_rt);
exit(0);
});
`
Would you like to help me to test my serialized array ? you can dowload here:
http://s000.tinyupload.com/index.php?file_id=09206376323751810777
Until today, I still stuck with this problem .
Please help me
Thank You