I would like to ask if there is any option in MySQL to auto-convert empty strings to NULL? The problem is that I use MySQL to store lots of integer values from HTML forms, but there is possibility to leave form empty which result in query looking like this:
$query = "UPDATE table SET number=''";
And with this query MySQL sets number value to '0' instead of NULL ;-(
I was thinking about some string converting with PHP to make query like this:
$query = "UPDATE table SET number=NULL;"
, but this seems to be very unconformtable, because I would have to parse each variable.
Thanks for any help