Hey,
Ik ben bezig met wat mysql in java, alleen ik wil dus nu 3 querys hebben dat hij ook de online-time erbij rekent.
Maar ik loop een beetje vast.
Ik heb nu deze drie:
Een speler online:
Quote:
UPDATE `users_online` SET `time` = NOW(), `time_total` = IF(`online`=1, ADDTIME(`time_total`, TIMEDIFF(NOW(), `time`)), `time_total`), `online`=1 WHERE `name`= " + username + "
Een speler offline:
Quote:
UPDATE `users_online` SET `time` = NOW(), `time_total` = IF(`online`=1, ADDTIME(`time_total`, TIMEDIFF(NOW(), `time`)), `time_total`), `online`=0 WHERE `name`= " + username + "
Alle spelers offline:
Quote:
UPDATE `users_online` SET `time` = NOW(), `time_total` = IF(`online`=1, ADDTIME(`time_total`, TIMEDIFF(NOW(), `time`)), `time_total`), `online`=0
Alleen het wil maar niet echt..
Wat is er fout?
Bedankt!
Wouter
Ik ben bezig met wat mysql in java, alleen ik wil dus nu 3 querys hebben dat hij ook de online-time erbij rekent.
Maar ik loop een beetje vast.
Ik heb nu deze drie:
Een speler online:
Quote:
UPDATE `users_online` SET `time` = NOW(), `time_total` = IF(`online`=1, ADDTIME(`time_total`, TIMEDIFF(NOW(), `time`)), `time_total`), `online`=1 WHERE `name`= " + username + "
Een speler offline:
Quote:
UPDATE `users_online` SET `time` = NOW(), `time_total` = IF(`online`=1, ADDTIME(`time_total`, TIMEDIFF(NOW(), `time`)), `time_total`), `online`=0 WHERE `name`= " + username + "
Alle spelers offline:
Quote:
UPDATE `users_online` SET `time` = NOW(), `time_total` = IF(`online`=1, ADDTIME(`time_total`, TIMEDIFF(NOW(), `time`)), `time_total`), `online`=0
Alleen het wil maar niet echt..
Wat is er fout?
Bedankt!
Wouter

