我的数据库中有一个名为“维护”的表,其中包含以下列。
顺序 (INT11) from_date (DATETIME) to_date (DATETIME) serviceimpact (LONGTEXT) servicesaffected (LONGTEXT) reason (LONGTEXT)
基本上,我在服务器的服务维护将要发生时添加数据,所以我希望信息在几天前from_date
显示,然后在几天后仍然显示,to_date
然后在消失后显示一条消息说
“短期内不会进行任何维护”
目前我有:
$sql="SELECT * FROM maintenance where from_date >= date(NOW()) and to_date <= date(NOW()) ORDER BY from_date ASC";
$rs=mysql_query($sql,$conn) or die(mysql_error());
if(mysql_num_rows($rs) > 0)
{
while($result=mysql_fetch_array($rs))
{
echo '<strong>Maintenance Period:</strong> '.$result["from_date"].' to '.$result["to_date"].'<br><br>';
echo '<strong>Services Affected</strong><br>';
echo nl2br(stripslashes($result["servicesaffected"])).'<br><br>';
echo '<strong>Service Impact:</strong><br>';
echo nl2br(stripslashes($result["serviceimpact"])).'<br><br>';
echo '<strong>Reason for Maintenance:</strong><br>';
echo nl2br(stripslashes($result["reason"])).'<br><br><hr /><br><br';
}
}
else
{
//otherwise, display a message to say everything is running fine
echo 'There is currently no planned outages for maintenance or upgrade on any of our platforms.';
}
但它没有按我的意愿工作 - 有什么想法我能做的吗?