query("SELECT * FROM rooster WHERE dag = DATE('" . $_GET["date"] . "') AND docent = " . $_GET['docent'] .";"); if ($result->num_rows === 0) { $conn->query("INSERT INTO rooster (dag, docent, opmerking, locatie) VALUES (DATE('" . $_GET['date'] . "'), " . $_GET['docent'] . ", '" . $_POST['opmerking'] . "', " . $_POST['locatie'] . ");"); } else { $conn->query("UPDATE rooster SET opmerking = '" . $_POST["opmerking"] . "', locatie = " . $_POST["locatie"] . " WHERE docent = " . $_GET['docent'] . " AND dag = DATE('" . $_GET['date'] . "');"); } } header('Location: /dashboard');