I am familiarising myself with the Fat Free Framework. I am trying to query a database and return the result in json format.
$user=new DB\SQL\Mapper($db,'wilt');
$filter = array();
$option = array(
'order' => 'created DESC',
'limit' => 7
);
$list=$user->find($filter,$option);
echo json_encode($list);
When I use $list=$user->find($filter,$option);, it returns 3 empty records. When I use $list=$user->cast(), it returns the one record with the fields, but the values are null.
How can I combine find and cast?
try this one:
$list = array_map(array($user,'cast'),$user->find($filter,$option));
echo json_encode($list);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With