Database 1366 Incorrect Integer values

The lastest versions of MySQL and MariaDB enable “strict mode” by default.  Strict mode controls how MariaDB and MySQL handle invalid or missing values in data-change statements such as INSERT or UPDATE. Applications not built with strict mode enabled may cause undesired behavior.

Got a  1366 – Incorrect integer value error in your osCommerce site?

The quick fix is to edit your /etc/my.cnf file and set sql_mode=””  (null).

If you do not have access to the server my.cnf and your host won’t change it then your next options are:

  1.  Changing the field to have a default value eg. zero.
  2. Try changing the database field type from an integer something like tinytxt. This only works if the field just holds data and is not used mathematically.
  3. Editing the code and assigning the correct value to the field, prior to the insert/update statement, the hardest change of all, but of course the correct one.

More information about strict mode is here.

If you need help patching your site to work with strict mode then please contact us.

UPDATE:  See quick patch