Peringatan tanggal kedaluwarsa di PHP
<?php
$r = mysql_query($q);
$output = '';
if(mysql_num_rows($r))
{
while($d = mysql_fetch_assoc($r))
{
if($d['diff'] < 0)
{
$notes = "EXPIRED";
}elseif($d['diff'] <= 14){
$notes = "ALERT";
}else{
$notes = '';
}
$output .= "<tr><td>{$d['machine']}</td><td>{$d['received_date']}</td><td>{$d['expiry_date']}</td><td>{$d['consignee']}</td><td>$notes</td></tr>";
}
}
?>
<table>
<thead>
<tr>
<th>Machine</th>
<th>Received Date</th>
<th>Expiry Date</th>
<th>Consignee</th>
<th>Notes</th>
</tr>
</thead>
<tbody>
<?php echo $output;?>
</tbody>
</table>
Coder Khayrul