我是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');


谢谢!

最佳答案

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

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

关于php - CodeIgniter数据库查询中出现错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/24594455/

10-11 13:09