scmeeker Posted July 30, 2010 Share Posted July 30, 2010 I'm trying to force a NULL value into the database with a hidden value and I can't seem to get it to work. Any suggestions? <input type="hidden" name="inactive" value=""/> I also tried here too: $sql="UPDATE product SET inactive='NULL' WHERE id = '$item_id'"; Quote Link to comment https://forums.phpfreaks.com/topic/209297-trying-to-force-a-null-value/ Share on other sites More sharing options...
Alex Posted July 30, 2010 Share Posted July 30, 2010 Don't use quotes because then it thinks that you're trying to insert the string "NULL": $sql="UPDATE product SET inactive=NULL WHERE id = '$item_id'"; Quote Link to comment https://forums.phpfreaks.com/topic/209297-trying-to-force-a-null-value/#findComment-1092897 Share on other sites More sharing options...
scmeeker Posted July 30, 2010 Author Share Posted July 30, 2010 I tried removing the quotes but it is still giving me a value of "0" in my database instead of "NULL". Quote Link to comment https://forums.phpfreaks.com/topic/209297-trying-to-force-a-null-value/#findComment-1092906 Share on other sites More sharing options...
scmeeker Posted July 30, 2010 Author Share Posted July 30, 2010 I had to also make a change in the table, then your change worked. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/209297-trying-to-force-a-null-value/#findComment-1092915 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.