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'"; 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'"; 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". 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! 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
Archived
This topic is now archived and is closed to further replies.