新人小白,CI后台如何写?
前端APPvar sendData = {Mobile, Psw, Name};
后台由CI完成简单的查询,插入数据库操作$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);}
但是现在在前端打印,发现返回的对象是NULL。想请教一下大家:1、哪些地方有问题?2、如何在服务器上对PHP代码进行跟踪调试?
先輸出看看有沒有取到值
echo $query->result_array(); //多筆
echo $query->row_array(); //單筆 Closer 发表于 2015-1-16 11:44
先輸出看看有沒有取到值
echo $query->result_array(); //多筆
echo $query->row_array(); //單筆 ...
谢谢,我在浏览器中直接输入地址,提示:call to a member function num_rows() on a non-object
代码:$query = $this->db->get_where('myTable', array('Mobile' => $Mobile), 1);if(0 < $query->num_rows()) { $resultData = array ( 'result' => '号码已经存在' ); echo json_encode($resultData);}
我在CI的用户指南中看到就是这么写的啊?
页:
[1]