这是我的数据库示例:
**Netname** **BldgName** **Totalduration**
LRT - 2 Araneta Center - Cubao 09:30:00
LRT - 2 Legarda 09:45:00
LRT - 2 Pureza 09:50:00
LRT - 2 Santolan 10:00:00
LRT - 2 Recto Station 09:55:00
然后我有一个持续时间的组合框......
Duration
5 s
10 s
15 s
30 s
60 s
这是我的代码:
if(($get_ID == "LRT - 2" || $get_ID == "LRT - 1") && $row[fldTotalDuration] == "10:00:00")
{
echo " ";
echo $row['fldBldgName'];
echo " <img src='image/full.png' title='Already full'><br>";
}
else if(($get_ID == "LRT - 2" || $get_ID == "LRT - 1")&& $row['fldTotalDuration'] >= "09:55:00" && $row['fldTotalDuration'] <= "10:00:00" && $get_duration >= "6 s" && $get_duration <= "60 s" )
{
echo " ";
echo $row['fldBldgName'];
echo " <img src='image/near_full.png' title='Only 5 s left'><br>";
}
else if(($get_ID == "LRT - 2" || $get_ID == "LRT - 1")&& $row['fldTotalDuration'] >= "09:50:00" && $row['fldTotalDuration'] <= "09:54:00" && $get_duration >= "11 s"&& $get_duration <="60 s" )
{
echo " ";
echo $row['fldBldgName'];
echo " <img src='image/near_full.png' title='Only 10 s left'><br>";
}
else if(($get_ID == "LRT - 2" || $get_ID == "LRT - 1")&& $row['fldTotalDuration'] >= "09:45:00" && $row['fldTotalDuration'] <= "09:49:00" && $get_duration >= "16 s" && $get_duration <= "60 s")
{
echo " ";
echo $row['fldBldgName'];
echo " <img src='image/warning.png' title='Only 15 s left'><br>";
}
else if(($get_ID == "LRT - 2" || $get_ID == "LRT - 1")&& $row['fldTotalDuration'] >= "09:30:00" && $row['fldTotalDuration'] <= "09:44:00" && $get_duration >= "31 s" && $get_duration <= "60 s")
{
echo " ";
echo $row['fldBldgName'];
echo " <img src='image/warning.png' title='Only 30 s left'><br>";
}
else if(($get_ID == "LRT - 2" || $get_ID == "LRT - 1")&& $row['fldTotalDuration'] >= "09:00:00" && $row['fldTotalDuration'] <= "09:29:00" && $get_duration > "60 s")
{
echo " ";
echo $row['fldBldgName'];
echo " <img src='image/warning.png' title='Only 60 s left'><br>";
}
示例场景:
我选择“5 s”持续时间......
这是我的程序的输出:这个是错误的....
输出应该是..
这是正确的输出:
因为我只会在总持续时间中添加“5 秒”......其余持续时间正在工作,但不是这个 [5 秒]
谢谢您的帮助..