I have to update a user in my DB. It validates and goes through all the code perfectly, but it does not change it in the DB. This leads me to conclude that the problem is with my query.
public function edit_user($data, $users_id) {
$this->db->set('updated_at', 'NOW()', FALSE);
return $this->db->update('users', $data, array('id' = > $users_id));
}
I have no idea why it's not working.
Try this:
public function edit_user($data, $users_id)
{
$this->db->set('updated_at', date('Y-m-d H:i:s'), FALSE);
return $this->db->update('users', $data, array('id' => $users_id));
}
Instead of updating current date You can change database column settings 'updated_at' - set on update current_timestamp.