This is one bug that had me smitten ever since Mysql 5 was released. If you had encountered this error and are searching in vain throughout google and msn for a fix, please do not be discouraged. This is a very simple problem and can be corrected easily.

1) Use SQL_MODE functionality:

Login to the Mysql shell and give the following command.


Voila. That fixes your problem.

2) Revert to Mysql 4.

If you are not sure on how to do 1), this is the only other option avaliable.

Just for programmers:

In the olden days, PHP programmers were amazed by the freedom offered by PHP and Mysql. Unlike their C counterparts, they were not needed to declare any variable. While Oracle and Mssql programmers were worrying about the sql constraints, Mysql was being such a sweet ‘art and was letting them insert/modify anything into its tables. But it doesn’t seem to be practical anymore.

So, if you are a programmer and have found this bug in your code, I am very sorry. I think you might need to rewrite most of your queries. But don’t panic. It is not all that complex. I would tell you what to do.

Lets take an example query:

1264 – Out of range value adjusted for column ‘products_id’ at row 1

insert into products_notifications (products_id, customers_id, date_added) values (”, ‘2’, now())

In the above query, the error was thrown for ‘products_id’ because products_id is an integer field and the programmer was trying to insert an empty string into it. Got my point? So, just because Mysql was silent all these days, we can’t exploit a field like this. Can we? This is how the query should be.

insert into products_notifications (products_id, customers_id, date_added) values (‘1’, ‘2’, now())

Hope my suggestion helped you. 🙂