php - How to get the array of a 2d array in codeigniter -
i have model,
function getdata($id) { $arr=array(array()); $sql = "select id, title topic ...."; $query = $this->db->query($sql,array($id)); $arr[0][0] = $query->result(); $sql = "select id, title topic ...."; $query = $this->db->query($sql,array($id)); $arr[0][1] = $query->result(); return $arr; } and in controller, have code,
$data['check'] = $this->model->getdata("21313"); ... $this->load->view('check',$data); how can echo data?
i tried,
foreach($check[0][0] $row) { echo $row->id; echo $row->title; } but not working.
try print_r($data); first on controller
and check structure if $check model result can on view
foreach($check $row) { echo $row->id; echo $row->title; }
Comments
Post a Comment