Tuesday 29 October 2013

Error: SQLSTATE[HY000]: General error: 1364 Field ‘xyz’ doesn’t have a default value


By default, MySQL is enabled with strict_mode ON, which will most likely cause problems with older PHP applications written for MySQL 4. For example, strict mode will return an error on insert statements if an empty string is provided where an integer is expected.
You may disable strict mode in one of two ways:

you can run the following in phpMyAdmin
SET @@global.sql_mode="";
or Open your “my.ini” file within the MySQL installation directory, and look for the text “sql-mode”. Find:
# Set the SQL mode to strict
 sql-mode=”STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER, NO_ENGINE_SUBSTITUTION”
and change to
# Set the SQL mode to strict
sql-mode=”NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION”
********