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的用户指南中看到就是这么写的啊?
貼上你這段程式碼所在的"檔案所有內容"及"所在資料夾路徑" 可能是你的“$this->db->get_where('myTable', array('Mobile' => $Mobile), 1);”这个语句返回的结果为空。 SQL语句错了 看看是表不存在 还是字段不存在 谢谢大家的回复,我再查查数据库。
页:
[1]