I am trying to update the database with new newpwd only if the new password is entered... Otherwise, i would like it to leave it as it was...
Currently, I am using a workaround and setting it as the password field which is the current password on else. So my question is, is there a way for me to avoid using an else statement? I don't want to update the password row in the database if the new password is not entered.
My code:
$this->db->update("userinfo", array(
'email' => $this->input->post('email'),
'password' => ($this->input->post('newpwd') !== "") ? md5($this->input->post('newpwd')) : md5($this->input->post('password'))));