我正在尝试运行以下查询:
"insert into visits set source = 'http://google.com' and country = 'en' and ref = '1234567890';"
该查询对我来说看起来不错,它会打印一条警告:
1 row(s) affected, 2 warning(s): 1364 Field 'country' doesn't have a default value 1292 Truncated incorrect DOUBLE value: 'http://google.com'
并且信息未按预期存储:
id , ref , bnid, source, country
'5', NULL, NULL, '0' , ''
如果我运行正常的语法,例如:
insert into visits (source,country,ref) values('http://google.com','en','1234567890');
我得到了预期的结果:
'6', '1234567890', NULL, 'http://google.com', 'en'
第一个语法(插入集)在以前的服务器中工作。现在我用 cpanel 改成了一个,但它没有。这是本周我第二次在带有 cpanel 的两个不同 VPS 中遇到这个问题,所以我猜它应该是版本号或 mysql 配置。
mysql版本:5.1.63-cll
桌子:
CREATE TABLE `visits` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`ref` varchar(64) DEFAULT NULL,
`bnid` int(11) DEFAULT NULL,
`source` varchar(256) DEFAULT NULL,
`country` varchar(10) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8
有什么帮助吗?