简体   繁体   中英

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!

尝试更改您的控制器,像这样

$data['courses'] = $this->courses_model->course()->result();

尝试更改模型:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM