Haushaltsbuch/historie.php
2025-11-18 20:37:13 +01:00

50 lines
1.5 KiB
PHP

<?php
require_once __DIR__ . '/includes/db_connect.php';
$stmt = $pdo->query("SELECT m.name,
hrg.jahr,
hrg.betrag
FROM hist_restguthaben hrg
JOIN monat m ON m.id = hrg.monat_id;");
$historie = $stmt->fetchAll(PDO::FETCH_ASSOC);
?>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="header">
<a href="index.php"
class="konto_header"
id="konto_navigationRechts">
HOME
</a>
</div>
<div class="inhalt">
<table>
<tr>
<th id="th_gebucht">Jahr</th>
<th id="th_ausgegeben">Monat</th>
<th id="th_betrag">Betrag</th>
</tr>
<?php foreach ($historie as $y): ?>
<tr>
<td class="td_datum">
<?= htmlspecialchars($y['name']) ?? '' ?>
</td>
<td class="td_datum">
<?= htmlspecialchars($y['jahr']) ?? '' ?>
</td>
<td class="<?= $y['betrag'] < 0 ? 'td_zahl_neg' : 'td_zahl_pos' ?>">
<?= number_format($y['betrag'], 2, ",", ".") ?> €
</td>
</tr>
<?php endforeach; ?>
</table>
</div>
</body>
</html>