How to print an array like in the sample below with Codeigniter
my code:
public function getDatas()
{
$this->db->from('table');
$query = $this->db->get();
$data = $query->result();
$return = array();
foreach($data as $datas)
{
$return[] = $datas->value1;
$return[] = $datas->value1;
}
return json_encode($return);
}
I'd like to get this sample, but my code fails somehow?
[[1,3,'test','data'],[4,56,'test','data'],[44,98,'test','data']];