I have a problem with Codeigniter. I am unable to display data in view file. Given below is the code of my model, controller and view file. I have also attached a screenshot of the error for better clarity.
Model
public function get_projects ($userid = '')
{
if (empty($userid)){
return FALSE;
}
$this->db->select('*');
$this->db->from('projects');
$this->db->where('userid', $userid);
$query = $this->db->get();
return $query->row_array();
}
Controller
$uid = $this->session->userdata('user_id');
$data['details']= $this->projects->get_projects($uid);
$this->load->view('design/header', $data);
$this->load->view('design/nav', $data);
$this->load->view('content/dashboard', $data);
$this->load->view('design/footer', $data);
View
<div class="col-6">
<?php foreach ($details as $row){ echo $row->id; } ?>
</div>
Error

return $query->row_array();Seeps that returns the data as an associative array.var_dump($row);furthermore in theese situations you can use a tool namedxdebugas well.var_dump($row)on the first line of it from that figure out what type of variable is. (After you debugged it just remove it). Aboutvar_dump()look on documentation.