我似乎无法找到需要半冒号或“}”的地方
for ($period=1; $period<6; $period++)
{
echo "<tr><td>".$period."</td>";
for ($room=0; $room<sizeof($rooms_array); $room++)
{
$sql = "SELECT Username FROM Booking WHERE RoomID ='".$rooms_array[$room]."' AND Period = '".$period."' AND Date = '".$sentdate."'";
$result= sqlite_query($con,$sql);
$row = sqlite_fetch_array($result);
if($row['Username']==$_SESSION['Username'])
{
echo "<td>Booked By ".$row['Username']."</td>"
}
}
}
?>
答案 0 :(得分:3)
你的echo语句后需要一个分号:
{echo "<td>Booked By ".$row['Username']."</td>";}
如果采用更清晰的块/缩进样式,可能更容易找到这样的错误。你的代码很难阅读。
例如:
for ($period=1; $period<6; $period++)
{
echo "<tr><td>".$period."</td>";
for ($room=0; $room<sizeof($rooms_array); $room++)
{
$sql = "SELECT Username FROM Booking WHERE RoomID ='".$rooms_array[$room]."' AND Period = '".$period."' AND Date = '".$sentdate."'";
$result= sqlite_query($con,$sql);
$row = sqlite_fetch_array($result);
if($row['Username']==$_SESSION['Username'])
{
echo "<td>Booked By ".$row['Username']."</td>";
}
}
}
答案 1 :(得分:2)
此处缺少;
:
{echo "<td>Booked By ".$row['Username']."</td>"}
^
答案 2 :(得分:0)
echo "<td>Booked By ".$row['Username']."</td>"
缺少分号