在我的PHP脚本中运行它时,我无法弄清楚为什么它不起作用。它使用PHPMyAdmin ...
工作正常You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near
'INSERT INTO `gamecoms_website`.`DailyUsers` (UserCount, TheDate, TheTime, TheDat' at line 2
以下是代码:
SET SESSION time_zone = '+00:00';
INSERT INTO `gamecoms_site`.`DailyUsers` (UserCount, TheDate, TheTime, TheDateTime) VALUES ('$online', CURDATE(), CURTIME(), NOW());
DELETE FROM `gamecoms_site`.`DailyUsers` WHERE TheDateTime < ADDTIME(NOW(), '-24:00:00');
SELECT `UserCount`, `TheDate` , `TheTime`, `TheDateTime` INTO @UserCount ,@TheDate ,@TheTime ,@TheDateTime FROM `gamecoms_website`.`DailyUsers` ORDER BY UserCount DESC LIMIT 1;
UPDATE `gamecoms_site`.`AllTimeUsers`
SET
TheDate = CASE WHEN UserCount < @UserCount THEN @TheDate END,
TheTime = CASE WHEN UserCount < @UserCount THEN @TheTime END,
TheDateTime = CASE WHEN UserCount < @UserCount THEN @TheDateTime END,
UserCount = CASE WHEN UserCount < @UserCount THEN @UserCount END;