我无法弄清楚为什么在我的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;
最佳答案