I am using codeigniter to build my site and don’t see a reason for the where portion of my clause in an update query.
It’s working as it should but is this okay to do? If not what are the pitfalls associated with it?
thanks in advance?
public function reset_password()
{
$salt = $this->_salt();
$this->load->library('encrypt');
$data = array(
'password' => $this->encrypt->sha1($salt . $this->encrypt->sha1($this->input->post('password'))),
'salt' => $salt
);
$this->db->update('users', $data);
}
when executing an update, if you don’t include a where clause, it will update all values in the table.
so in this case, everyone’s password and salt will be set to this new value.