start of schedules api endpoint

This commit is contained in:
Sundog Jones 2024-09-10 16:44:22 -04:00
parent 5ecb9b4944
commit 66ac62f6da
1 changed files with 18 additions and 0 deletions

18
schedule.php Normal file
View File

@ -0,0 +1,18 @@
<?php
$db = new SQLite3('netv-mam.sqlite');
if (isset($_GET['date']) && $_GET['date'] !== "") {
// get info about single day's schedule
$query = $db->prepare("SELECT * FROM schedules WHERE date = :date");
$query->bindValue(":date", intval($_GET['date']));
$result = $query->execute();
if ($result) {
$row = $result->fetchArray(SQLITE3_ASSOC);
echo(json_encode($row));
}
} else {
echo("{}");
}
?>