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

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -