Q:

Getting error in CodeIgniter DB query

I am new in CodeIgniter. I am trying to get table rows by get function by getting below the error
A PHP Error was encountered
Severity: Notice
Message: Trying to get property of non-object
Filename: views/viewBySemester.php
Line Number: 17

In Controller
$data['courses'] = $this->courses_model->Course();

In Model
return $this->db->get('courses');

Thanks!

A:

Try by changing in your controller, something like this
$data['courses'] = $this->courses_model->course()->result();

