useci 发表于 2015-1-16 15:09:48

call to a member function num_rows() on a non-object

database是在autoload中自动加载的,却报了错误:call to a member function num_rows() on a non-object
代码:$Mobile = $this->input->post('Mobile', TRUE);$query = $this->db->get_where('myTable', array('Mobile' => $Mobile), 1);if(0 < $query->num_rows()) {    $resultData = array (      'result' => '号码已经存在'     );    echo json_encode($resultData);}
我在CI的用户指南中看到就是这么写的啊?

Closer 发表于 2015-1-16 15:31:42

貼上你這段程式碼所在的"檔案所有內容"及"所在資料夾路徑"

yhdeng 发表于 2015-1-16 16:53:11

可能是你的“$this->db->get_where('myTable', array('Mobile' => $Mobile), 1);”这个语句返回的结果为空。

nic 发表于 2015-1-16 17:59:05

SQL语句错了 看看是表不存在 还是字段不存在

useci 发表于 2015-1-16 20:21:01

谢谢大家的回复,我再查查数据库。
页: [1]
查看完整版本: call to a member function num_rows() on a non-object