V
V
Vladimir2017-01-03 13:06:40
PHP
Vladimir, 2017-01-03 13:06:40

What does this mean Warning: 1265 Data truncated for column?

Good day! Project in Yii2. When I try to update a record, I get:

Database Exception – yii\db\Exception
SQLSTATE[01000]: Warning: 1265 Data truncated for column 'sale' at row 1
The SQL being executed was: UPDATE `house` SET `area`=100, `kitchen`=NULL, `live_area`=97, `room`=3, `floor`=NULL, `floors_qty`=NULL, `sale`='' WHERE `id`=1

Error Info: Array
(
    [0] => 01000
    [1] => 1265
    [2] => Data truncated for column 'sale' at row 1
)

↵
Caused by: PDOException
SQLSTATE[01000]: Warning: 1265 Data truncated for column 'sale' at row 1

in /home/segnava/sites/goldhouse-new/vendor/yiisoft/yii2/db/Command.php at line 844

When I developed on OpenServer (Windows) and after uploading to the server, everything worked. After I switched everything to Linux (LAMP), it gives me this error. What could be the problem. I read something about Strict SQL Mode, but I can't figure out how to fix it. Please tell me what is the problem? Thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir, 2017-01-03
@MasterGerold

Проблема решилась таким способом. У меня стоит поле ENUM ''0,'1' а default стоит NULL. И на сколько я понимаю значение NULL длиннее чем 0 или 1. И когда я задаю напрямую 0 или 1 то всё работает. Спасибо Евгению за помощь!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question