php - Increase field by value -
php - Increase field by value -
first of, code:
$logout = $db->prepare("update users set online = '0', last_online = '$time', times_logged_in = times_logged_in + 1, time_spent_online = time_spent_online + $timespent id = '$sessid'"); my problem lastly update "time_spent_online = time_spent_online + $timespent" how supposed format it? can't write number in plain because number varies depending on how long user online.
you shouldn't have a field time_spent_online. instead should calculate time on fly whenever requested (and of course of study cache results when needed).
in table need record each time user logs in. table can calculate estimate of time spent online
php mysql pdo
Comments
Post a Comment