Answer the question
In order to leave comments, you need to log in
Loose typing Incorrect integer value: '' for column, how to fix?
There is an error of this kind Incorrect integer value: '' for column 'Tekstura' at row 1.
I have an empty value in an int type field. On one server, the value worked and set an empty value, or rather 0.
I understand that you need to set the loose typing mode, but I can’t figure out which one.
And can it be done with just a query?
I am using MySQL 5.6
INSERT INTO `Plitka_Tovar`(
`Fabrika`, `Kollekciya`, `Nazvanie`,
`Material`, `Poverhnosty`, `Tekstura`,
`Tip`, `Vid_izdeliya`, `Kratnosty`,
`S_Facetom(Kabanchik)`, `Tehnicheskiy_keramogranit`,
`Tonkiy_keramogranit`, `title`,
`keywords`, `description`, `divh1`,
`tags`, `size1`, `size2`, `size3`,
`f_sht`, `f_m2`, `f_kg`, `f_kor`,
`f_kor_m2`, `sizeP1`, `sizeP2`, `sizeP3`,
`img`
)
VALUES
(
'68', '227', 'Rect Line Amethyst',
'1', '1', '', '2', '2', 'м2', 'Нет',
'', '', '', '', '', '', 'Colorker, Vivenza, Керамическая плитка, Глянцевая, глазурованная, Пэтчворк, Восточный, Для стен, Ванная, Плитка для ванной комнаты, Прямоугольная, Декор',
'29.5', '89.3', '1', '3', '0.78', '14.8',
'75', '58.50', '', '', '', '../img/Plitka_Tovar/55ffae561e167.jpg'
)
Answer the question
In order to leave comments, you need to log in
That's right: fix your backend. Pass numbers as numbers. Worse: as Dmitri Kim
pointed out , or more explicitly IF(:tekstura != '', :tekstura, 0)
Worst and what actually distinguishes this host from another where this query is fine: change sql_mode https://dev.mysql .com/doc/refman/5.6/en/sql-mode.html
alter table tbl(tekstura int default 0);
something like this ;)
SET `Tekstura` = IF(:tekstura, :tekstura, 0)
or
SET `Tekstura` = IF(:tekstura, :tekstura, NULL)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question