在CodeIgniter数据库查询中获取错误

时间:2014-07-06 09:30:05

标签: php mysql codeigniter

我是CodeIgniter的新手。我试图通过获取低于错误的函数来获取表格行

A PHP Error was encountered
Severity: Notice
Message: Trying to get property of non-object
Filename: views/viewBySemester.php
Line Number: 17

在控制器中

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

在模型中

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

谢谢!

2 个答案:

答案 0 :(得分:0)

尝试更改控制器,例如

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

答案 1 :(得分:0)

尝试更改模型:

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