Hi hope someone can help, I have a field called DateBooked which by default is NULL.
As expected strtotime brings back 01/01/1970
I am using DateBooked as one of the fields on an email that is being sent automatically.
I need an IF statement to check if DateBooked is NULL and if so return blank and if not return the date as d-m-y.
The code below runs fine to insert the info in the email, I'm just not sure where to put the IF to check DateBooked is NULL or not.
function getTrainingHtml($data) {
$training = '';
foreach ($data as $value) {
$training .= '
<tr style="line-height: 25px;">
<td width="15%" style="border-bottom: 1px solid #ddd;">'.$value['FirstName'].' '.$value['LastName'].'</td>
<td width="40%" style="border-bottom: 1px solid #ddd;">'.$value['CourseName'].'</td>
<td width="10%" style="border-bottom: 1px solid #ddd;">'.date('d-m-Y' , strtotime ($value['ExpiryDate'])).'</td>
<td width="10%" style="border-bottom: 1px solid #ddd;">'.date('d-m-Y' , strtotime ($value['DateBooked'])).'</td>
<td width="25%" style="border-bottom: 1px solid #ddd;">'.$value['Notes'].'</td>
</tr>';
}
return $training;
}
function executeQuery($query)