tamumech Posted July 10, 2007 Share Posted July 10, 2007 Hi all. I am inserting a lot of data into a MySQL integer column via an html form. When a field in the form is left blank, I want the value in MySQL to be NULL, but it keeps inputting '0'. The default value for my column is NULL. I don't really think there is a simple way to do this on the php side (using a hidden form to set blank entries equal to NULL would require an extra page), so I was wondering if MySQL had some sort of capability. Here's a snippet. UPDATE table SET column1 = '$_POST[$value1]', column2 = '$_POST[$value2]' WHERE id = '$_POST[$id]' Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.