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);
}
}
\ No newline at end of file
diff --git a/app/scripts/functions.php b/app/scripts/functions.php
index 007d1dc..741c0a4 100644
--- a/app/scripts/functions.php
+++ b/app/scripts/functions.php
@@ -102,7 +102,7 @@ function load_station_table($con, $s_id) {
\n";
$stmt = get_station($con, $s_id);
foreach($stmt->fetchAll() as $row) {
- echo "