summaryrefslogtreecommitdiff
path: root/intern.gospeladlershof.de/code/chor/update.php
blob: a781835e89d85bdf11228c9023f8c0bb75651e3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php

require_once __DIR__ . '/../db.php';
require_once __DIR__ . '/../session.php';

$db = get_db();

$id = $_REQUEST["id"];
$nachricht = $_REQUEST["termin"];

try {
	$stmt = $db->prepare("UPDATE chor set nachricht =:nachricht WHERE id=:id;");

	$stmt->bindValue(":id", $id);
	$stmt->bindValue(":nachricht", $nachricht);
	$stmt->execute();

} catch ( Exception $e ) {
	$_SESSION["error"] = $e->getMessage();
	error_log($e->getMessage());
}

if ( empty($_SESSION) || is_null($_SESSON["error"]) ) {
	$_SESSION["success"] = "Erfolgreich aktualisiert!";
}
header($_SERVER["SERVER_PROTOCOL"] . " 302 Redirect");
header("Location: /");