My logout function needs to update the latest row of a list of logins.
This is what I have came up with, however it doesn t even pass syntax validation.
$query =
UPDATE user_logins
SET active = 0
WHERE user_id = . Database::instance()->escape($this->getCurrentUserId()) .
AND datetime = MAX(datetime) LIMIT 1 ;
Essentially there may be 30 or so with the same user_id
value. I d only like to update the last login. This will obviously be the most recent datetime
value.
What am I doing wrong?