在布尔值上调用成员函数num_rows() [英] Call to a member function num_rows() on boolean
本文介绍了在布尔值上调用成员函数num_rows()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在第138行的C:\ xampp \ htdocs \ c \ application \ models \ usermodel.php中以布尔值调用成员函数num_rows()
Call to a member function num_rows() on boolean in C:\xampp\htdocs\c\application\models\usermodel.php on line 138
public function new_pass(){
$email = $this->input->post('email');
$pass1 = $this->input->post('pass1');
$pass2 = $this->input->post('pass2');
$result = $this->db->where('email', $email)->update('user',[
'pass1' => $pass1,
'pass2' => $pass2,
]);
if ($result->num_rows() == 1) {
return TRUE;
}else{
return FALSE;
}
}
推荐答案
For insert and update query we use $this->db->affected_rows()
也更改您的查询
public function new_pass(){
$email = $this->input->post('email');
$pass1 = $this->input->post('pass1');
$pass2 = $this->input->post('pass2');
$this->db->set('pass1',$pass1);
$this->db->set('pass2',$pass2);
$result = $this->db->where('email', $email);
$this->db->update('user');
$afftectedRows = $this->db->affected_rows();
if ($afftectedRows == 1) {
return TRUE;
}else{
return FALSE;
}
}
这篇关于在布尔值上调用成员函数num_rows()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文