Upcoming Movements

" . htmlspecialchars($value ?? '') . (!empty($value) ? " Z" : "") . ""; } 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"; } else { return "" . htmlspecialchars($value ?? '') . ""; } } function renderActionsCell($id) { return " "; } function renderTableRow($row) { $rowHtml = ""; foreach ($row as $key => $value) { if (!in_array($key, ['id', 'ac_call', 'notes'])) { // Exclude 'notes' $rowHtml .= renderTableCell($key, $value, $row); } } $rowHtml .= renderActionsCell($row['id']); $rowHtml .= ""; return $rowHtml; } function renderTable($result) { $tableHtml = ""; $fields = $result->fetch_fields(); foreach ($fields as $field) { if (!in_array($field->name, ['id', 'ac_call', 'notes'])) { // Exclude 'notes' $tableHtml .= ""; } } $tableHtml .= ""; while ($row = $result->fetch_assoc()) { $tableHtml .= renderTableRow($row); } $tableHtml .= "
" . htmlspecialchars($field->name ?? '') . "Actions
"; return $tableHtml; } $conn = connectDb(); $sql = "SELECT id, ac_reg, ac_type, ac_call, eta AS ETA, fuel, in_from, pob_in, notes FROM submitted WHERE DATE(eta) > CURDATE() ORDER BY eta ASC;"; $result = $conn->query($sql); if ($result->num_rows > 0) { echo renderTable($result); } else { echo "
No upcoming movements found.
"; } $conn->close(); ?>