我希望我能在这里解决未定义的属性:Siswa :: $ siswa_model

时间:2015-07-02 16:42:42

标签: php codeigniter

,消息:在null上调用成员函数get_paged_list()文件名:controllers / siswa.php 这是我的完整代码 http://pastebin.com/ZBHkBS8i

问题解决了,感谢baci和bora

1 个答案:

答案 0 :(得分:0)

你不应该像这样调用模型

$siswas = $this->siswa_model->
get_paged_list($this->limit,$offset,$order_column,$order_type) ->result();

但是喜欢这个

$this->load->model("siswa_model");
$result = $this->siswa_model->
get_paged_list($this->limit,$offset,$order_column,$order_type)

并且在模型中你应该查询数据库结束返回结果,类似这样的

public function get_paged_list($limit,$order_column,$order_type)
{
$q_str = "select * from table ....etc ";
$q = $this->db->query($q_str);
return $q->result();
}

希望有所帮助