it is now possible to edit station entries
This commit is contained in:
@@ -358,4 +358,39 @@ function change_time($con, $m_id, $s_id, $time) {
|
||||
} catch(PDOException $e) {
|
||||
handle_pdo_exception($e);
|
||||
}
|
||||
}
|
||||
|
||||
function get_station_all($con, $s_id) {
|
||||
try {
|
||||
$stmt = $con->prepare("SELECT * FROM Station WHERE s_id = :s_id");
|
||||
$stmt->execute(['s_id' => $s_id]);
|
||||
$stmt->setFetchMode(PDO::FETCH_ASSOC);
|
||||
return $stmt;
|
||||
} catch(PDOException $e) {
|
||||
handle_pdo_exception($e);
|
||||
}
|
||||
}
|
||||
|
||||
function update_station_name($con, $s_id, $name) {
|
||||
try {
|
||||
echo $s_id . "\n";
|
||||
echo $name . "\n";
|
||||
$stmt = $con->prepare("UPDATE Station SET name = ? WHERE s_id = ?");
|
||||
$stmt->bindParam(1, $name, PDO::PARAM_STR);
|
||||
$stmt->bindParam(2, $s_id, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
} catch(PDOException $e) {
|
||||
handle_pdo_exception($e);
|
||||
}
|
||||
}
|
||||
|
||||
function update_station_pos($con, $s_id, $pos) {
|
||||
try {
|
||||
$stmt = $con->prepare("UPDATE Station SET standort = ? WHERE s_id = ?");
|
||||
$stmt->bindParam(1, $pos, PDO::PARAM_STR);
|
||||
$stmt->bindParam(2, $s_id, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
} catch(PDOException $e) {
|
||||
handle_pdo_exception($e);
|
||||
}
|
||||
}
|
||||
@@ -35,9 +35,9 @@ function generate_password_hash($password, $salt) {
|
||||
}
|
||||
|
||||
function load_stations_table($con) {
|
||||
$stmt = get_stations($con);
|
||||
$stmt = get_stations_all($con);
|
||||
foreach($stmt->fetchAll() as $row) {
|
||||
echo "<tr>";
|
||||
echo "<tr id=\"" . $row['s_id'] . "\">";
|
||||
echo "<td>" . $row['name'] . "</td>";
|
||||
echo "<td>" . $row['standort'] . "</td>";
|
||||
echo "</tr>";
|
||||
|
||||
Reference in New Issue
Block a user