netv-mam/schedule.php

25 lines
669 B
PHP
Executable File

<?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 s
LEFT JOIN schedule_blocks sb ON s.day = sb.schedule_day
LEFT JOIN blocks b ON sb.block_id = b.id
WHERE s.day = :date");
$query->bindValue(":date", intval(strtotime($_GET['date'])));
$result = $query->execute();
if ($result) {
$row = $result->fetchArray(SQLITE3_ASSOC);
echo(json_encode($row));
}
} else if (isset($_POST['day']) && strtotime($_POST['day'])) {
// add or update a single schedule
} else {
echo("{}");
}
?>