prepare($sql); $stmh->bindValue(':day', $day, PDO::PARAM_INT); $stmh->bindValue(':todo', $todo, PDO::PARAM_STR); $stmh->execute(); echo json_encode(['status' => 'success']); } catch (PDOException $Exception) { echo json_encode(['status' => 'error', 'message' => $Exception->getMessage()]); } } elseif ($_SERVER['REQUEST_METHOD'] === 'GET') { $day = isset($_GET['day']) ? $_GET['day'] : ''; try { $sql = "SELECT todo FROM todos WHERE day = :day"; $stmh = $pdo->prepare($sql); $stmh->bindValue(':day', $day, PDO::PARAM_INT); $stmh->execute(); $todos = $stmh->fetchAll(PDO::FETCH_ASSOC); echo json_encode($todos); } catch (PDOException $Exception) { echo json_encode(['status' => 'error', 'message' => $Exception->getMessage()]); } } ?>