<?php
include "connection.php";
header("Content-Type: application/json");

$subject_id = $_GET['subject_id'] ?? 0;
$rs = Database::search("SELECT * FROM lesson WHERE subject_id = '$subject_id'");
$data = [];

while ($row = $rs->fetch_assoc()) {
    $data[] = $row;
}

echo json_encode(["status" => true, "data" => $data]);
?>
