首页 > 数据库技术 > 详细

MySQL出现Incorrect integer value: '' for column 'id' at row 1解决方法

时间:2019-12-27 16:13:08      阅读:304      评论:0      收藏:0      [点我收藏+]

用mysql建了个表:

create table file_table ( id int auto_increment primary key, filename varchar(50) not null,filepath varchar(50) not null,update_time date);

然后用mysql写如下的插入语句:

query = "Insert into file_table". " values (‘‘,‘$name‘,‘$filepath‘,now())"; 

 

出现如下错误:

Incorrect integer value: ” for column ‘id’ at row 1

 

解决办法:
查了一下是因为用了高版本的mysql导致的,发现高版本的mysql如果是空值应该要写NULL或者0,所以插入语句应写成:

query = "Insert into file_table". " values (NULL,‘$name‘,‘$filepath‘,now())"; 

或者

query = "Insert into file_table". " values (0,‘$name‘,‘$filepath‘,now())"; 

 

 

原文链接:https://blog.csdn.net/king_jie0210/article/details/52411195

MySQL出现Incorrect integer value: '' for column 'id' at row 1解决方法

原文:https://www.cnblogs.com/jsdy/p/12107866.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!