[eluser]Michael Ekoka[/eluser]
in the following code I want to update the password field in one record :
Code:
$form_data = $this->input->post('form_data');
// I get my input from a form
$user_id = $form_data['user_id'];
$password = md5($form_data['password']);
$this->db->where('id',$id);
// notice the mistake I just made: instead of $user_id, I used $id that has not yet been
// initialized or declared.
$this->db->update('users',array('password'=>$password));
What I will end up doing here is update the password field of
all records in the table. So, fellow CodeIgniters beware when making update and delete operations like these.