I am updating a form and have an issue whereby i can't insert a NULL value into a datetime field. The datetime field allows NULL and is NULL by default.
I have tried inserting a NULL directly into the table and that works fine.
I believe that the issue is being caused because I am sending 'NULL' as opposed to NULL.. but i'm not entirely sure how i can do it using the following approach :
$insert_sql = sprintf("INSERT INTO enquiry (enquirysubmitted) VALUES ('%s');", mysql_real_escape_string($enquirysubmitted));
The reason why i need to be able to insert null is because the date may or may not be needed. For example, someone could enter a date and decide later that it no longer applies.