I am trying to code an alert system where it will display alerts from a system, and this will keep the alert active until the alert date is expired. Currently the alert will only stay active on the date inputted.
<?
$query_rsGetAlerts = "SELECT * FROM alerts WHERE DAY(alert_expiary) <= DAY(CURDATE()) AND MONTH(alert_expiary) <= MONTH(CURDATE()) AND YEAR(alert_expiary) <= YEAR(CURDATE())";
$rsGetAlerts = mysql_query($query_rsGetAlerts) or die(mysql_error());
$row_rsGetAlerts = mysql_fetch_assoc($rsGetAlerts);
$totalRows_rsGetAlerts = mysql_num_rows($rsGetAlerts);
do {
echo "<div class=\"alert alert-" . $row_rsGetAlerts['alert_type'] . "\" role=\"alert\">". $row_rsGetAlerts['alert_message'] ."</div>";
} while($row_rsGetAlerts = mysql_fetch_assoc($rsGetAlerts));
?>
Table Data:
id alert_type alert_message alert_expiary
1 success Arron's Birthday is on the 16th October 2015-10-16
2 danger The next training day is on 14th October 2015-10-1
Table Structure:
1 id int(222) AUTO_INCREMENT
2 alert_type varchar(222) latin1_swedish_ci
3 alert_message varchar(222) latin1_swedish_ci
4 alert_expiary date