Home >Database >Mysql Tutorial >MySQL 错误 1366:1366 Incorrect integer value

MySQL 错误 1366:1366 Incorrect integer value

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-07 15:33:583194browse

MySQL 错误 1366:1366 Incorrect integer value 这个必须记录下来,整整折磨了我一天,最后发现其实只是一个sql错误跟其他的没有任何关系,像这样的问题经验较丰富的程序员应该会第一时间想到是 mysql问题,但是一般的人都会认为是php源程序出错了,这是个思

MySQL 错误 1366:1366 Incorrect integer value

这个必须记录下来,整整折磨了我一天,最后发现其实只是一个sql错误跟其他的没有任何关系,像这样的问题经验较丰富的程序员应该会第一时间想到是 mysql问题,但是一般的人都会认为是php源程序出错了,这是个思维惯性,平时接触最多的就是php代码,所以很难想到是MySQL问题,虽然已经提示的很明显了,执行以后提示错误代码时“1366 Incorrect integer value: '' for column 'configuration_group_id' at row 1
in:
[INSERT INTO nfj_configuration_group VALUES ('', 'Easy Populate', 'Config options for Easy Populate', '1', '1')]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.
”。

1366错误是MySQL配置问题,你只要找到my.ini文件并查找sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"这句话,将双引号前面{STRICT_TRANS_TABLES,}删除,改成sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION",重启一下mysql后即可。前者很严格,不允许向数据库插入空值,所以就会有Value后面那个单引号。切忌看错误提示啊,不然弯路够你走的啊。。。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn