嗨,我编写了更改密码的代码,但它不会更改表中的密码,而是将当前密码设为 0。所以我该怎么做。谢谢
这是我的模特
function changepassword() {
$this->db->select('id');
$this->db->where('username', $this->session->userdata('username'));
$this->db->where('password', $this->input->post('OldPassword'));
$query = $this->db->get('mau_user');
if ($query->num_rows() > 0) {
$row = $query->row();
if ($row->id === $this->session->userdata('id')) {
$data = array(
'password' => $this->input->post('password')
);
$this->db->where('username', $this->session->userdata('username'));
$this->db->where('password', $this->input->post('OldPassword'));
if ($this->db->update('mau_user', $data)) {
return "Password Changed Successfully";