XF 2.0 MySQL query error [1366]: Incorrect integer value: '' for column

AndrewSimm

Well-known member
I get this error when saving to a database
PHP:
XF\Db\Exception: MySQL query error [1366]: Incorrect integer value: '' for column 'roster_number' at row 1 in src/XF/Db/AbstractStatement.php at line 212

I am not saving anything to roster_number, as it's not used in the form I am using. Do I have to assign a value to each field?
 
Unless fields are nullable, you have to define a default value either in the database or the entity (best both) or explicitly set it each time.
 
Unless fields are nullable, you have to define a default value either in the database or the entity (best both) or explicitly set it each time.

It looks like I can leave strings blank, but not integers. I have a default value in the database, so it looks like adding a default to the entity fixed my issue.
 
Back
Top Bottom