$store_list = array();
$this->db->select('user_time');
$this->db->from('users');
$this->db->where('staff_id',$userid);
$result = $this->db->get();
$result= $result->result();
foreach($result as $rows){
array_push($store_list, $rows["user_time"]);
}
return $store_list;
I have written a function in a model which contains the above-mentioned code which fetches user's time when user's id passed as a parameter and returns user's time it to the controller function.
But I'm getting the following error: Fatal Error: Cannot use object of type stdClass as array
What's causing this error? Any ideas?
Note: the sql query returns all matched records. It can be one or more than one records.