<?php
include("../db.php");
header("Access-Control-Allow-Origin: * ");

$class = $_REQUEST['class'];
$section = $_REQUEST['section'];

$status = 0;
$data = array();

$sql = $db->getRows("select * from liveclass_list where class='$class' order by id desc");
if (count($sql) > 0) {


    foreach ($sql as $teacher) {

        $sec = json_decode($teacher['section']);
        if (in_array($section, $sec)) {
            $status = 1;
            array_push($data, ["id" => $teacher['id'], "date" => "$teacher[date]", "time" => "$teacher[time]", "class" => "$teacher[class]", "section" => $sec,
                "subject" => "$teacher[subject]", "url" => "$teacher[url]", "teacher_id" => "$teacher[teacher_id]", "Status" => "$teacher[status]"]);
        }

    }

}

echo json_encode(array('status' => $status, 'data' => $data));

