Incorrect integer value – How to change mysql sql_mode
You might be an unlucky soul me where you need to maintain a bunch of old and poorly written code. You’ll also probably get a bunch of weird errors if you’re running recent versions of PHP and mysql locally such as “invalid integer value xxx” when trying to modify a record. This occurs because the application is probably trying to insert a string into an INT field in mysql. Anyway, since the number of bugs are too numerous to fix in this application, the easiest solution is to remove the strict settings from your mysql.
To view the current sql mode setting:
SELECT @@sql_mode; |
To remove all settings (and allow string to get inserted into INT cols)
SET global sql_mode=""; |