Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

expiry date alert in 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>
 
PREVIOUS NEXT
Tagged: #expiry #date #alert #php
ADD COMMENT
Topic
Name
8+6 =