Php Can';t执行查询:BIGINT无符号值超出范围
每10分钟启动一次计划的cron作业后出现以下错误:Php Can';t执行查询:BIGINT无符号值超出范围,php,mysql,error-handling,cron,Php,Mysql,Error Handling,Cron,每10分钟启动一次计划的cron作业后出现以下错误: Output from command /usr/bin/php -q /var/www/html/mydomain/_cron/cron.php .. PHP Notice: Can't execute query: BIGINT UNSIGNED value is out of range in '(`karsi_jiggo`.`user`.`hide_time` - 10)' UPDATE user SET hide_time=(h
Output from command /usr/bin/php -q /var/www/html/mydomain/_cron/cron.php ..
PHP Notice: Can't execute query: BIGINT UNSIGNED value is out of range in '(`karsi_jiggo`.`user`.`hide_time` - 10)'
UPDATE user SET hide_time=(hide_time-10), last_visit=last_visit WHERE hide_time>0 in /var/www/html/MyDomain/_include/lib/db.php on line 100
Notice: Can't execute query: BIGINT UNSIGNED value is out of range in '(`karsi_jiggo`.`user`.`hide_time` - 10)'
UPDATE user SET hide_time=(hide_time-10), last_visit=last_visit WHERE hide_time>0 in /var/www/html/MyDomain/_include/lib/db.php on line 100
根据您的输出,您的数据库中似乎有隐藏时间>0但为0的数据 并且隐藏时间<10 您的查询
UPDATE user SET hide_time=(hide_time-10), last_visit=last_visit WHERE hide_time>0
…如果在查询开始时是5
,则会很高兴地尝试将hide_time设置为-5
(hide_time>0根据旧值而不是更新值进行选择)
BIGINT UNSIGNED
无法保存负值,因此出现错误。您的问题是什么?这里是我的cron.php的现场直播,我如何更正它?如果($min%1==0){DB::execute(“更新用户集hide_time=(hide_time-10),last_visit=last_visit WHERE hide_time>0”);最安全的更改方法是将WHERE子句更改为WHERE hide_time>10
,这样它就不会试图将其转换为负数。
UPDATE user SET hide_time=(hide_time-10), last_visit=last_visit WHERE hide_time>0