MySQL said: Incorrect integer value: ” for column ‘your_column’

Later versions of MySQL (my current version MySQL 5.6) will throw an error, if attempting to insert empty (i.e. '') values into a row with INT settings - even with NULL set to "YES"
ERROR: "MySQL said: Incorrect integer value: '' for column 'your_column'"

[SHORTCODE_Insert_Google_Adsence_Here]
You can prevent this error with PHP/MySQL, with a disable of  “STRICT_TRANS_TABLES" - which is triggering the error, on the empty string, you are trying to insert.

$My_Query = " SET SESSION sql_mode= 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'; ";
 *No spaces between the commas

Set it back after if you like… Although I belive it is automatically set back.

SET SESSION sql_mode= 'STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' 


*No spaces between the commas

See what your MySQL says about the current settings via phpMyAdmin:

SELECT @@GLOBAL.sql_mode;
SELECT @@SESSION.sql_mode;

Leave a Reply