show teams table and terminate db connection

This commit is contained in:
2022-06-08 12:30:53 +02:00
parent c701d808e5
commit 42cd6956b9
7 changed files with 55 additions and 4 deletions

View File

@@ -73,4 +73,15 @@ function get_stations($con) {
} catch(PDOException $e) {
handle_pdo_exceptio($e);
}
}
function get_teams($con) {
try {
$stmt = $con->prepare("SELECT name, feuerwehr FROM Mannschaft");
$stmt->execute();
$stmt->setFetchMode(PDO::FETCH_ASSOC);
return $stmt;
} catch(PDOExeption $e) {
handle_pdo_exception($e);
}
}

View File

@@ -42,4 +42,14 @@ function load_stations_table($con) {
echo "<td>" . $row['standort'] . "</td>";
echo "</tr>";
}
}
function load_teams_table($con) {
$stmt = get_teams($con);
foreach($stmt->fetchAll() as $row) {
echo "<tr>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['feuerwehr'] . "</td>";
echo "</tr>";
}
}