began with implementing edeting for statistics

This commit is contained in:
2022-06-10 16:20:22 +02:00
parent 20970ebf3a
commit afbfe52688
8 changed files with 55 additions and 69 deletions

View File

@@ -109,7 +109,7 @@ function get_station_name($con, $s_id) {
function get_station($con, $s_id) {
try {
$stmt = $con->prepare("SELECT M.name as Name, M.feuerwehr as Feuerwehr, P.punkte as Punkte, P.zeit as Zeit FROM Punkte as P, Station as S, Mannschaft as M WHERE P.s_id = S.s_id AND S.s_id = :s_id AND M.m_id = P.m_id ORDER BY Punkte DESC");
$stmt = $con->prepare("SELECT P.m_id as m_id, M.name as Name, M.feuerwehr as Feuerwehr, P.punkte as Punkte, P.zeit as Zeit FROM Punkte as P, Station as S, Mannschaft as M WHERE P.s_id = S.s_id AND S.s_id = :s_id AND M.m_id = P.m_id ORDER BY Punkte DESC");
$stmt->execute(['s_id' => $s_id]);
$stmt->setFetchMode(PDO::FETCH_ASSOC);
return $stmt;
@@ -232,7 +232,7 @@ function change_user_name($con, $id, $user_name) {
$stmt->bindParam(1, $user_name, PDO::PARAM_STR);
$stmt->bindParam(2, $id, PDO::PARAM_STR);
$stmt->execute();
} catch(PDOExeption $e) {
} catch(PDOException $e) {
handle_pdo_exception($e);
}
}
@@ -244,7 +244,7 @@ function change_user_group($con, $id, $user_group, $s_id) {
$stmt->bindParam(2, $s_id, PDO::PARAM_INT);
$stmt->bindParam(3, $id, PDO::PARAM_INT);
$stmt->execute();
} catch(PDOExeption $e) {
} catch(PDOException $e) {
handle_pdo_exception($e);
}
}
@@ -255,7 +255,19 @@ function change_password($con, $id, $password) {
$stmt->bindParam(1, $password, PDO::PARAM_STR);
$stmt->bindParam(2, $id, PDO::PARAM_STR);
$stmt->execute();
} catch(PDOExeption $e) {
} catch(PDOException $e) {
handle_pdo_exception($e);
}
}
function get_result($con, $m_id, $s_id) {
try {
$stmt = $con->prepare("SELECT P.*, M.name as name, M.feuerwehr as feuerwehr FROM Punkte P, Mannschaft M WHERE M.m_id = P.m_id AND P.m_id = ? AND P.s_id = ?");
$stmt->bindParam(1, $m_id, PDO::PARAM_INT);
$stmt->bindParam(2, $s_id, PDO::PARAM_INT);
$stmt->execute();
return $stmt;
} catch(PDOException $e) {
handle_pdo_exception($e);
}
}

View File

@@ -102,7 +102,7 @@ function load_station_table($con, $s_id) {
<tbody>\n";
$stmt = get_station($con, $s_id);
foreach($stmt->fetchAll() as $row) {
echo "<tr>\n";
echo "<tr id=\"" . $row['m_id'] . "\" class=\"row\">\n";
echo "<td>" . $row['Name'] . "</td>\n";
echo "<td>" . $row['Feuerwehr'] . "</td>\n";
echo "<td>" . $row['Punkte'] . "</td>\n";