I have this simple chunk of code that updates the user's last login with the current timestamp. If last_login
is set to NULL and then I perform an UPDATE
query it will work, however it won't if last_login
already has a value.
Here's my code:
PHP:
$time = time();
$user_id = $active_user->id;
DB::query('UPDATE `users` SET `last_login` = ? WHERE `id` = ?;', array($time, $user_id));