<?php
$servername = "localhost";
$username = "fids";
$password = "password";
$dbname = "fids";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// $sql = "SELECT id, flight_arrival, flight_departure, rego, pax_in, pax_out, bags, freight, origin, destination, sta, eta, std, fuel, ramp, taxi, burn, staff_flt_comment, bay FROM flights";
$sql = "SELECT id, flight_arrival, flight_departure, rego, origin, destination, sta, eta, std, bay, pax_flt_comment, arrival_comment, departure_comment FROM flights";
$result = $conn->query($sql);
echo "<!DOCTYPE html>
<html>
<head>
<style>
body {background-color: black;}
h1 {color: white;}
p {color: white;}
text { color: white;}
table, th, td {
border: 1px solid white;
border-collapse: collapse;
text-align: center;
border-spacing: 5px;
text {color: white};
}
</style>
</head>
<body text=ffffff>
<center>";
if ($result->num_rows > 0) {
// output data of each row
echo "ARRIVALS<br>";
// header line arrivals
echo "<table> <tr><th> ID </th> <th> Flight </th> <th>Origin</TH> <th>STA</th> <th>ETA</th> <TH> COMMENTS </tr>";
// while($row = $result->fetch_assoc()) {
// data line - repeaters until all rows dispalyed
$arrivals = [];
$departures = [];
while($row = $result->fetch_assoc()) {
array_push($arrival, $row);
array_push($departure, $row);
echo "<tr><td>".$arrival["id"]. "</td> <td>".$arrival["flight_arrival"]. "</td><td>".$arrival["origin"]. "</td><td>".$arrival["sta"]. "</td><td>".$arrival["eta"]. "</td><td>".$arrival["pax_flt_comment"]. "</td></tr>";
}
echo "</table><P>";
} else {
echo "0 results";
}
echo "<p align=center>";
//echo .$row["arrival_comment"];
// deparutes section - to be fixed
//echo "DEPARTURES<br>";
// header line arrivals
// echo "<table> <tr><th> ID </th> <th> Flight </th> <TH> Dest </TH> <th> STD </th> <TH>BAY</TH> ";
// while($row = $result->fetch_assoc()) {
// data line - repeaters until all rows dispalyed
// echo "<tr><td>".$row["id"]. "</td><td>".$row["flight_departure"]. "</td><td>".$row["destination"]. "</td><td>".$row["std"]. "</td><td>".$row["pax_comment"]. "</td></tr>";
// }
//echo "</table><P>";
//} else {
// echo "0 results";
//}
$conn->close();
?>
Comments