Files
ppr/arrivals.php
2025-04-07 16:27:01 +00:00

144 lines
4.2 KiB
PHP

<?php
include("functions.php");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="300">
<script>
document.addEventListener("DOMContentLoaded", function() {
let rows = document.querySelectorAll("table tbody tr");
rows.forEach(row => {
let fuelCell = row.cells[3]; // Get the "Fuel" cell (index 3)
if (fuelCell.textContent == "100LL") {
row.classList.add("highlight100LL"); // Add the class
} else if (fuelCell.textContent == "JET A1") {
row.classList.add("highlightJET"); // Add the class
}
});
});
</script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Swansea Daily PPR</title>
<style>
/* Styling for the table */
table {
width: 90%;
border-collapse: collapse;
margin: 20px auto;
background-color: #000; /* Black background for digital display effect */
color: #0f0; /* Bright green text for digital display effect */
font-family: 'Courier New', Courier, monospace; /* Monospace font for digital look */
font-size: 18px;
text-align: center;
}
table, th, td {
border: 1px solid #444; /* Subtle border for table cells */
}
th {
padding: 10px;
background-color: #222; /* Darker background for headers */
color: #fff; /* White text for headers */
font-weight: bold;
text-transform: uppercase;
}
td {
padding: 10px;
}
tr:nth-child(even) {
background-color: #111; /* Slightly lighter background for even rows */
}
tr:hover {
background-color: #333; /* Highlight row on hover */
}
/* Highlight styles for fuel types */
.highlight100LL {
background-color: #0044cc !important; /* Blue for 100LL */
color: #fff !important; /* White text */
}
.highlightJET {
background-color: #ffcc00 !important; /* Yellow for JET A1 */
color: #000 !important; /* Black text */
}
/* Styling for aircraft registration */
.acreg {
font-size: 14px;
font-style: italic;
color: #ccc; /* Light gray for subtle emphasis */
}
</style>
</head>
<body>
<center><h2>Swansea Inbound PPR <?php echo date('l d M Y'); ?></h2></center>
<?php
// Create connection
$conn = connectDb();
$custom_headings = [
'column1' => 'Custom Heading 1',
'column2' => 'Custom Heading 2',
'column3' => 'Custom Heading 3'
// Add more custom headings as needed
];
// Define your SQL query
$sql = "SELECT ac_reg, ac_type, ac_call, TIME_FORMAT(eta,'%H:%i') AS ETA, fuel, in_from, pob_in FROM submitted WHERE DATE(eta) = CURDATE() AND status = 'NEW' ORDER BY eta ASC;"; // Replace with your table name
// Execute the query
$result = $conn->query($sql);
// Check if there are results
if ($result->num_rows > 0) {
// Start HTML table
echo '<table border="1">
<thead>
<tr>';
// Output table headers (assuming column names are known)
$fields = $result->fetch_fields();
foreach ($fields as $field) {
if ($field->name != 'ac_call') {
echo '<th>' . htmlspecialchars($field->name ?? '') . '</th>';
}
}
echo ' </tr>
</thead>
<tbody>';
// Output table rows
while ($row = $result->fetch_assoc()) {
echo '<tr>';
foreach ($row as $key => $value) {
if ($key != 'id' && $key != 'ac_call') {
if ($key == 'ac_reg' && $row['ac_call'] != NULL) {
echo '<td>' . htmlspecialchars($row['ac_call'] ?? '') . "<br><span class=acreg>" . $value . '</span></td>';
} else {
echo '<td>' . htmlspecialchars($value ?? '') . '</td>';
}
}
}
echo '</tr>';
}
echo ' </tbody>
</table>';
} else {
echo "No results found.";
}
// Close the database connection
$conn->close();
?>