I have a php / mysql event lister and I am coming unstuck where I only want to auto delete a record if it's startdate (field_1) has passed and there is no future enddate set (field_5), so field_5 would need to be empty before it's deleted. Both start and end date fields are set to null on mysql dbase. I can get the code to delete a lapsed event using my code below but I have no idea how to apply mysql logic / conditional code required to check if the enddate (field_5) is set or empty, thereby preventing a deletion if that field is set with a string date. Can anyone advise please ?
$eventstart ="STR_TO_DATE(field_1, '%m/%d/%Y')";
$eventend ="STR_TO_DATE(field_5, '%m/%d/%Y')";
mysql_query("DELETE FROM events3 WHERE $eventstart < $date ") or die(mysql_error());