function fixDates() { global $conn; global $MASTER_TABLE; $fixDates = mysqli_query($conn, "SELECT id, CheckDate from {$MASTER_TABLE} where importDate = CURDATE()"); while ($row = $fixDates->fetch_array()) { $id = $row["id"]; $CheckDate = $row["CheckDate"]; if ($CheckDate != null) { $dateFormat = new DateFormat(); $dateFormat->formatDate($CheckDate); $updateDates = mysqli_query($conn, "UPDATE {$MASTER_TABLE} SET CheckDate = '{$CheckDate}' where id = '{$id}'"); } } }