3
I was now doing an instruction with on Duplicate and I have some fields like BIT
. My class DB does the typing using PDO::PARAM_STR
, PDO::PARAM_BOOL
, PDO::PARAM_INT
... but the use of these constants is optional, and when not informed follows the standard of PDO
.
SQLSTATE[22001]: String data, right truncated: 1406 Data Too long for column 'FIELD' at Row 1' in [ ... ]
I omitted the constants at run time, so it was with the default value, but I received the above error message. The value passed was an integer 1
- not a string '1'
.
I’m trying to understand the difference between 1
guy int and 1
guy str. Like the MYSQL receives the same number and knows that one is a string and another is an integer?
i had a very similar problem, the cause was the PDO driver, remember this error happens only in some versions, you can add the versions of PHP and Mysql?
– Pedro Sanção
PHP : 5.4.28, MYSQL : 5.5.36-log
– Papa Charlie