简体   繁体   English

Mysql 上第 1 行的“直径”列的数据被截断

[英]Data truncated for column 'diameter' at row 1 on Mysql

Getting an error while trying to insert data into Mysql Table using datamapper ( Codeigniter )尝试使用 datamapper ( Codeigniter ) 将数据插入 Mysql 表时出错

Data truncated for column 'diameter' at row 1
INSERT INTO `purchases` (`bills_id`, `products_id`, `quantity`, `diameter`, `lena`, `lenb`, `lenr`, `thicka`, `thickb`, `widtha`, `widthb`, `boxes`, `resulta`, `resultb`) VALUES (1, 28, '2', '', '', '', '', '', '', '', '', '1', '', 2)

Here is the screenshot of the table这是表格的截图

截屏

You're trying to insert an empty string '' into double .您正在尝试将空字符串''插入double You cannot store string in a double column.您不能将string存储在double列中。 Make sure the date type is double or compatible ( int , float )确保日期类型为double或兼容( intfloat

Either insert a 0要么插入0

INSERT INTO `purchases` (`bills_id`, `products_id`, `quantity`, `diameter`, `lena`, `lenb`, `lenr`, `thicka`, `thickb`, `widtha`, `widthb`, `boxes`, `resulta`, `resultb`) VALUES (1, 28, '2', 0, '', '', '', '', '', '', '', '1', '', 2)

or

If there is no value, simply skip it in the query如果没有值,只需在查询中跳过它

INSERT INTO `purchases` (`bills_id`, `products_id`, `quantity`, `lena`, `lenb`, `lenr`, `thicka`, `thickb`, `widtha`, `widthb`, `boxes`, `resulta`, `resultb`) VALUES (1, 28, '2', '', '', '', '', '', '', '', '1', '', 2)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM