CodeIgniter Forums
Active Record gotcha - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: Active Record gotcha (/thread-3794.html)

Active Record gotcha - El Forum - 10-22-2007

[eluser]Michael Ekoka[/eluser]
in the following code I want to update the password field in one record :

$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']);

// notice the mistake I just made: instead of $user_id, I used $id that has not yet been
// initialized or declared.


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.