Commit ee03aa3b authored by uoure's avatar uoure
Browse files

Delete getReservations.php

parent 6be5c7fb
<?PHP
$user = 'apache';
$pass = 'e164AzpQx564TpJa';
$db = new PDO('mysql:host=localhost;dbname=reservation', $user, $pass);
// todo prevent sql injection
$statement = $db -> prepare("SELECT tables, opentime, closetime, event FROM opening WHERE date= ?");
$statement->execute(array($_GET["date"]));
$result = $statement->fetch();
$data = array("tables" => $result[0], "open" => $result[1], "close" => $result[2], "event" => $result[3]);
$statement = $db -> prepare("SELECT start, end, tisch FROM reservations WHERE date = ? AND ended = 0");
$statement->execute(array($_GET["date"]));
$reservations = array();
foreach( $statement->fetchAll() as $row ){
if (!array_key_exists("T".$row["tisch"], $reservations)) {
$reservations["T".$row["tisch"]] = array();
}
$rowdata = array("start" => $row["start"], "end" => $row["end"]);
array_push($reservations["T".$row["tisch"]], $rowdata);
}
$data["reservations"] = $reservations;
echo json_encode($data);
?>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment