Ok, this is driving me crazy!! Got a MySQL table with an integer field default set to null. Need to update it through a form submission. If form field is blank, set database field to NULL, ELSE set database field to form submission value.
So, in PHP I have: (staging code, still needs to be sanitized)
if($_POST['vendor-product'] != ''){
$ms2VendorID = $_POST['vendor-product'];
}else{
$ms2VendorID = '';
}
The problem is that instead of NULL it enters a zero. I've tried several different ways and nothing seems to be working.
Thanks for any help.