Swansea Inbound PPR

connect_error) { die("Connection failed: " . $conn->connect_error); } $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 id, status, 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 != 'DELETED' 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 ''; // Output table headers (assuming column names are known) $fields = $result->fetch_fields(); foreach ($fields as $field) { if ($field->name != 'status' && $field->name != 'id' && $field->name != 'ac_call') { echo ''; } } echo ''; echo ' '; // Output table rows while ($row = $result->fetch_assoc()) { echo ''; foreach ($row as $key => $value) { if ($key != 'status' && $key != 'id' && $key != 'ac_call') { if ($key == 'ac_reg' && $row['ac_call'] != NULL) { echo ''; } else { echo ''; } } } echo ''; echo ''; } echo '
' . htmlspecialchars($field->name ?? '') . 'actions
' . htmlspecialchars($row['ac_call'] ?? '') . "
" . $value . '
' . htmlspecialchars($value ?? '') . '' . $row['status'] .'
'; } else { echo "No results found."; } // Close the database connection $conn->close(); ?>