Tower Ops

Inbound Aircraft
" . htmlspecialchars($value ?? '') . (!empty($value) ? " Z" : "") . ""; // Add "Z" suffix only if not blank } if ($key == 'ac_reg' && $row['ac_call'] != NULL) { $notes = htmlspecialchars($row['notes'] ?? ''); $acCall = htmlspecialchars($row['ac_call'] ?? ''); $acReg = htmlspecialchars($value ?? ''); if (!empty($row['notes'])) { return "$acCall
$acReg"; } return "$acCall
$acReg"; } elseif ($key == 'ac_reg' && !empty($row['notes'])) { $notes = htmlspecialchars($row['notes'] ?? ''); $acReg = htmlspecialchars($value ?? ''); return "$acReg"; } elseif ($key == 'in_from' || $key == 'out_to') { if (!empty($value) && (strlen($value) === 3 || strlen($value) === 4)) { $airportName = getAirport(connectDb(), $value); if ($airportName) { return "" . htmlspecialchars($value) . "
" . htmlspecialchars($airportName) . ""; } } return "" . htmlspecialchars($value ?? '') . ""; } else { return "" . htmlspecialchars($value ?? '') . ""; } } function renderActionsCell($id, $status = null) { if ($status === 'LANDED') { return " "; } else { return " "; } } function renderTableRow($row) { $rowHtml = ""; foreach ($row as $key => $value) { if (!in_array($key, ['notes', 'status', 'id', 'ac_call'])) { $rowHtml .= renderTableCell($key, $value, $row); } } $rowHtml .= renderActionsCell($row['id'], $row['status']); $rowHtml .= ""; return $rowHtml; } function renderTable($result) { $tableHtml = ""; $fields = $result->fetch_fields(); foreach ($fields as $field) { if (!in_array($field->name, ['notes', 'status', 'id', 'ac_call'])) { $tableHtml .= ""; } } $tableHtml .= ""; while ($row = $result->fetch_assoc()) { $tableHtml .= renderTableRow($row); } $tableHtml .= "
" . htmlspecialchars($field->name ?? '') . "actions
"; return $tableHtml; } $conn = connectDb(); $sql = "SELECT id, status, ac_reg, ac_type, ac_call, TIME_FORMAT(eta,'%H:%i') AS ETA, fuel, in_from, pob_in, notes FROM submitted WHERE DATE(eta) = CURDATE() AND (status = 'NEW' OR status = 'CANCELED') ORDER BY eta ASC;"; // Replace with your table name $result = $conn->query($sql); if ($result->num_rows > 0) { echo renderTable($result); } else { echo "No results found."; } ?>
Visiting Aircraft
query($sql); // Check if there are results if ($result->num_rows > 0) { echo renderTable($result); // Use the renderTable function } else { echo "No results found."; } // Close the database connection $conn->close(); ?>