我的查询是
INSERT INTO `messages_system(mes_id,mem_id,frm_id,subject,body,messages_system.type,new,folder,date,special,messages_system.read) VALUE('','51','48','title of the message','body of the message','message','new','sent','1305024405','','');`
此查询提供错误
MySQL said:
#1366 - Incorrect integer value: '' for column 'mes_id' at row 1
如何解决此问题mes_id
是我的主要身份。
答案 0 :(得分:1)
只需在字段和值列表中省略mes_id
:
INSERT INTO `messages_system` (mem_id,frm_id,subject,body,messages_system.type,new,folder,date,special,messages_system.read) VALUES ('51','48','title of the message','body of the message','message','new','sent','1305024405','','')
或使用文字NULL
初始化它:
INSERT INTO `messages_system` (mes_id, mem_id,frm_id,subject,body,messages_system.type,new,folder,date,special,messages_system.read) VALUES (NULL, '51','48','title of the message','body of the message','message','new','sent','1305024405','','')
答案 1 :(得分:0)
将主键列设置为AUTO_INCREMENT。
答案 2 :(得分:0)
您需要为auto_increment
设置mes_id
属性,并从查询中删除mes_id
。