add entries to statistics
This commit is contained in:
@@ -116,4 +116,42 @@ function get_station($con, $s_id) {
|
||||
} catch(PDOException $e) {
|
||||
handle_pdo_exception($e);
|
||||
}
|
||||
}
|
||||
|
||||
function get_teams_no_points($con, $s_id) {
|
||||
try {
|
||||
$stmt = $con->prepare("SELECT M.* FROM Mannschaft M WHERE M.m_id NOT IN (SELECT P.m_id FROM Punkte P WHERE P.s_id = :s_id)");
|
||||
$stmt->execute(['s_id' => $s_id]);
|
||||
$stmt->setFetchMode(PDO::FETCH_ASSOC);
|
||||
return $stmt;
|
||||
} catch(PDOException $e) {
|
||||
handle_pdo_excepiton($e);
|
||||
}
|
||||
}
|
||||
|
||||
function station_exists($con, $s_id) {
|
||||
try {
|
||||
$stmt = $con->prepare("SELECT s_id FROM Station WHERE s_id = :s_id");
|
||||
$stmt->execute(['s_id' => $s_id]);
|
||||
if($stmt->rowCount() > 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} catch(PDOException $e) {
|
||||
handle_pdo_exception($e);
|
||||
}
|
||||
}
|
||||
|
||||
function write_points($con, $s_id, $m_id, $points, $time) {
|
||||
try {
|
||||
$stmt = $con->prepare("INSERT INTO Punkte (m_id, s_id, punkte, zeit) VALUES (?, ?, ?, ?)");
|
||||
$stmt->bindParam(1, $m_id, PDO::PARAM_INT);
|
||||
$stmt->bindParam(2, $s_id, PDO::PARAM_INT);
|
||||
$stmt->bindParam(3, $points, PDO::PARAM_INT);
|
||||
$stmt->bindParam(4, $time, PDO::PARAM_STR);
|
||||
$stmt->execute();
|
||||
} catch(PDOException $e) {
|
||||
handle_pdo_exception($e);
|
||||
}
|
||||
}
|
||||
@@ -108,4 +108,13 @@ function load_station_table($con, $s_id) {
|
||||
echo "</tr>\n";
|
||||
}
|
||||
echo "</tbody>\n";
|
||||
}
|
||||
|
||||
function load_teams_no_points($con, $s_id) {
|
||||
if (station_exists($con, $s_id)) {
|
||||
$stmt = get_teams_no_points($con, $s_id);
|
||||
foreach($stmt->fetchAll() as $option) {
|
||||
echo "<option value=\"" . $option['m_id'] . "\">" . $option['name'] . " " . $option['feuerwehr'] . "</option>";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user