add teams to teams table and fix for login

This commit is contained in:
2022-06-09 17:18:35 +02:00
parent af4207f66e
commit 80a03ec557
5 changed files with 85 additions and 5 deletions

View File

@@ -165,4 +165,25 @@ function write_station($con, $station_name, $station_pos) {
} catch(PDOException $e) {
handle_pdo_exceptio($e);
}
}
function get_fire_departments($con) {
try {
$stmt = $con->prepare("SELECT DISTINCT feuerwehr FROM Mannschaft");
$stmt->execute();
return $stmt;
} catch(PDOException $e) {
handle_pdo_exception($e);
}
}
function write_team($con, $team_name, $fire_department) {
try {
$stmt = $con->prepare("INSERT INTO Mannschaft (name, feuerwehr) VALUES (?, ?)");
$stmt->bindParam(1, $team_name, PDO::PARAM_STR);
$stmt->bindParam(2, $fire_department, PDO::PARAM_STR);
$stmt->execute();
} catch(PDOEXCEPTION $e) {
handle_pdo_exception($e);
}
}

View File

@@ -117,4 +117,11 @@ function load_teams_no_points($con, $s_id) {
echo "<option value=\"" . $option['m_id'] . "\">" . $option['name'] . " " . $option['feuerwehr'] . "</option>";
}
}
}
function load_fire_departments($con) {
$stmt = get_fire_departments($con);
foreach($stmt->fetchAll() as $option) {
echo "<option>".$option['feuerwehr']."</option>\n";
}
}