Store NULL if date is empty
If date field is empty then store NULL in the database.
this code isn't working. It doesn't store NULL it stores 0000-00-00 instead.
the default value of DateExpire Field is NULL.
if (ForceIncomingString('DateExpire', '') == "")
$sql->AddFieldNameValue('DateExpire', NULL);
else
$sql->AddFieldNameValue('DateExpire', FormatStringForDatabaseInput(FormatDateToMysql(ForceIncomingString('DateExpire', ''))));
this code isn't working. It doesn't store NULL it stores 0000-00-00 instead.
the default value of DateExpire Field is NULL.
0
This discussion has been closed.
Comments
UPDATE LUM_DISCUSSION SET Closed = 1 WHERE DateExpire IS NOT NULL AND NOW() > DateExpire;
It has to be NULL. it picks up 000-00-00 as not null and runs the querylist($month, $day, $year, $hour, $minute, $second ) = sscanf($date, "%d/%d/%d %d:%d:%d");
Wait, you could split the date and see what values are in the components for the null value. Then you could use that in your query.