用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

相关文章:

  • 2021-08-24
  • 2022-12-23
  • 2022-02-28
  • 2021-09-13
  • 2021-11-14
  • 2021-12-06
  • 2022-02-03
  • 2021-12-24
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-04-16
  • 2021-12-28
  • 2022-12-23
相关资源
相似解决方案