query("SELECT * FROM docenten WHERE username = '" . $_SESSION['username'] . "';"); $docent = $result->fetch_assoc(); if (isset($_GET['date'])) { $date = date("Y-m-d", strtotime($_GET['date'])); } else { $date = date("Y-m-d"); // Create date in mysql DATE format. } $rooster = $conn->query("SELECT * FROM rooster WHERE docent = " . $docent['id'] . " AND dag = DATE('" . $date . "')")->fetch_assoc();