gymrooster_php/php/index.php

17 lines
420 B
PHP
Executable File

<?php
require "conn.php";
if (isset($_GET['date'])) {
$date = date("Y-m-d", strtotime($_GET['date']));
} else {
$date = date("Y-m-d"); // Create date in mysql DATE format.
}
$result = $conn->query("SELECT * FROM rooster INNER JOIN docenten ON rooster.docent = docenten.id WHERE dag = DATE('" . $date . "');");
if ($result->num_rows === 1) {
$rooster = [$result->fetch_assoc()];
} else {
$rooster = $result;
}