$passeddate=$_GET["date"];
if ($passeddate !="")
{
$date=$passeddate;
}
$passedtime=$_GET["time"];
if ($passedtime !="")
{
$time=$passedtime;
}
$passedservice=$_GET["service"];
// Create connection
$conn = new mysqli(DBSERVER, DBUSER, DBPASSWD, DBNAME);
// Check connection
if ($conn->connect_error)
{
die("Connection failed: " . $conn->connect_error);
}
else
{
$sql = "SELECT * FROM timetable where date = \"".$date."\" order by timetable";
$result = $conn->query($sql);
if ($result->num_rows > 0)
{
while($row = $result->fetch_assoc())
{
$tt_type=$row["timetable"];
$tt_longname=$row["timetable_name"];
}
}
else
{
$tt_type="No";
$tt_longname="No Heritage Service Today";
}
}
echo "".$tt_longname ."
";
echo "". $date." ".substr($time, 0, 5). "
";
if ($tt_type != "No")
{
if ($passedservice == "")
{
echo"";
$sql = "SELECT * FROM timetable where date = \"".$date."\" order by date";
$result = $conn->query($sql);
if ($result->num_rows > 0)
{
while($row = $result->fetch_assoc())
{
$tt_longname=$row["timetable_name"];
echo "- ".$row["date"]." - " .$row["timetable_name"]."
";
}
}
echo"
";
echo " ";
}
else
{
echo " ";
}
}
else
{
?>
No heritage trams are in operation today.
Heritage services have been confirmed for these dates:
$sql = "SELECT * FROM timetable where date >= \"".$date."\" order by date";
$result = $conn->query($sql);
if ($result->num_rows > 0)
{
while($row = $result->fetch_assoc())
{
$tt_longname=$row["timetable_name"];
echo "- ".$row["date"]." - " .$row["timetable_name"]."
";
}
}
?>
}
?>
require("footer.php");
?>