I have to be able to be able to pull this date from the database and perform basic date calculations i.e add 366 days (this I can do which is no problem) I enter the date which is stored in a "$variable" created in another script on another part of the site and passed via a session variable into the database though on expiry of this date I would like to leave the field empty not specifically NULL as I now understand.
If I code so I null the field with SET col = NULL I cannot use a $variable to enter a date at a later date with out recoding. Is there a way of leaving a database field empty when it seemingly expects some value ?
So, instead of "SELECT * FROM schedule WHERE date IS NULL" we have to use "SELECT * FROM schedule WHERE date IS NULL OR Date = 0" (Note that you can't select where Date = '' (empty string) even though that was the way it was input). "WHERE id = '$id '; "$sql = ' UPDATE table ' .
From most of the code I've seen here, people like to have their SQL "pre-built" and just fill in the blanks.
When I do a record update for other fields it takes the null values in the date fields and changes it to 0000-00-00 everytime.