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

    $month = $_GET['month'];
    $year = $_GET['year'];

    $status = 0;
    $data = [];

    $calendar = $db->getRows("select * from calendar where month='$month' and year='$year' ");
    
    if(count($calendar) > 0 && is_array($calendar)){
    $status = 1;
        foreach ($calendar as $cal){
            array_push($data,[ "id"=>"$cal[id]", "date"=>"$cal[date]", "type"=>"$cal[type]", "remark"=>"$cal[remark]", "session"=>"$cal[session]", "month"=>"$cal[month]", "year"=>"$cal[year]", "entrytime"=>"$cal[entrytime]" ]);

        }
    }

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

?>