In PHP to check if a field from MySQL is null use the keyword is_null like: is_null($row[‘fld’])

In PHP to insert a Null value into MySQL field use the trick:
$date = is_null($row[‘date’]) ? “null”: “‘” . $row[‘date’] “‘”;

The following will not work:
$date = is_null($row[‘date’]) ? NULL: “‘” . $row[‘date’] “‘”;
This is because PHP null is different than MySQL null and in the above statement the PHP NULL will assign a blank to the var $date and inside MySQL query this blank appears as blank BUT MySQL requires null instead of blank.