ilhan ilhan - 1 month ago 4x
MySQL Question

How to allow empty string for integer in MySQL?

I have integer fields in a table. The POSTs are send by a complicated JavaScript. They send empty string like "" but as you guess MySQL doesn't allow emty strings in integer fields. Is there any option to allow empty strings? Like if it takes empty string it will save it as NULL.


Removing sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" from my.ini has solved the issue.