show teams table and terminate db connection
This commit is contained in:
@@ -12,4 +12,7 @@
|
||||
<h1><span>Punktesystem Kreispokalwettbewerb Altdorf</span></h1>
|
||||
<p>test</p>
|
||||
</body>
|
||||
<?php echo file_get_contents("html/footer.html"); ?>
|
||||
<?php
|
||||
$con = null;
|
||||
echo file_get_contents("html/footer.html");
|
||||
?>
|
||||
@@ -21,6 +21,7 @@
|
||||
echo "Gib bitte gültige Daten ein!";
|
||||
}
|
||||
}
|
||||
$con = null;
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
@@ -7,4 +7,24 @@
|
||||
|
||||
echo file_get_contents("html/header.html");
|
||||
?>
|
||||
<?php echo file_get_contents("html/footer.html"); ?>
|
||||
|
||||
<body>
|
||||
<div class="table-div">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Name</th>
|
||||
<th scope="col">Feuerwehr</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php load_teams_table($con); ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<?php
|
||||
echo file_get_contents("html/footer.html");
|
||||
$con = null;
|
||||
?>
|
||||
@@ -26,4 +26,7 @@
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<?php echo file_get_contents("html/footer.html"); ?>
|
||||
<?php
|
||||
echo file_get_contents("html/footer.html");
|
||||
$con = null;
|
||||
?>
|
||||
@@ -7,4 +7,7 @@
|
||||
|
||||
echo file_get_contents("html/header.html");
|
||||
?>
|
||||
<?php echo file_get_contents("html/footer.html"); ?>
|
||||
<?php
|
||||
echo file_get_contents("html/footer.html");
|
||||
$con=null;
|
||||
?>
|
||||
@@ -74,3 +74,14 @@ function get_stations($con) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -43,3 +43,13 @@ function load_stations_table($con) {
|
||||
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>";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user