Hier nochmal der ganze Code, vielleicht hab ich ja was falsch zusammengefügt.
PHP-Code:
<?php
session_start();
require_once("inc/config.inc.php");
//Überprüfe, dass der User eingeloggt ist
//Der Aufruf von check_user() muss in alle internen Seiten eingebaut sein
$user = check_user();
?>
<style>
<?php include 'css/count.css'; ?>
</style>
<?php
date_default_timezone_set('Europe/Berlin');
echo date("H:i:s <p>");
echo date("d.m.Y <p>");
?>
<?php
$statusMap = [
0 => 'S6',
1 => 'S1',
2 => 'S2',
3 => 'S3',
4 => 'S4',
5 => 'S5',
6 => 'S6',
7 => 'S7',
8 => 'S8',
9 => 'S6'
];
$status1Map = [
'S' => 'status2',
' Sp' => 'status2',
'test' => 'test'
];
$statement = $pdo->prepare("
SELECT Status, Fahrzeug, Status1
FROM Fahrzeug
WHERE Status in (1,2,3,4,7,8)
ORDER BY Fahrzeug ASC
");
$result = $statement->execute(); ?>
<?php while ($row = $statement->fetch(PDO::FETCH_OBJ): ?>
<table class="<?= $statusMap[$row->status] ?? 'S6' ?>">
<tr>
<td><?= htmlspecialchars($row->Fahrzeug, ENT_COMPAT, 'UTF-8') ?></td>
<td><?= htmlspecialchars($row->Status) ?></td>
</tr>";
<tr>
<td class="<?= $status1Map[$row->Status1] ?? 'status2def' ?>">
<?= htmlspecialchars($row->Status1) ?>
</td>
</tr>
</table>
<?php endwhile; ?>
Kommentar