php - 无法执行查询: BIGINT UNSIGNED value is out of range

标签 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=(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

最佳答案

根据输出,看起来数据库中的数据中hide_time为> 0但小于10,因此,当您尝试从hide_time中减去10时,它将成为负数,并且对于无符号int而言是超出范围的。

要排除故障,您可以

SELECT * from user
WHERE hide_time > 0
AND hide_time < 10

关于php - 无法执行查询: BIGINT UNSIGNED value is out of range,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20572300/

相关文章:

mysql - 使用复合索引优化查询,即使用where

error-handling - 用于错误检查的面向对象设计模式

mysql - 指定的字段可能引用我的 SQL 语句的 FROM 子句中列出的多个表

php - 如何获取codeigniter事件记录中的特定数组

javascript - 全局记录 jQuery 错误(事件和 DOM 错误)

powershell - 如果抛出错误,我如何继续处理项目?

php - 警告 : mysqli_free_result() again

php - php 数组中的井号键/哈希键/井号标签

javascript - 使用 AJAX 登录,其中数据位于文本文件中

php - 如何在ajax文件上传中显示进度条