在第138行的C:\ xampp \ htdocs \ c \ application \ models \ usermodel.php中调用boolean上的成员函数num_rows()
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;
}
}
答案 0 :(得分:4)
对于插入和更新查询,我们使用$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;
}
}