<?php

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

$date = $_REQUEST['date'];
$idno = $_REQUEST['idno'];
$session = $_REQUEST['session'];
$month = $_REQUEST['month'];

$school_id= 1;//$_REQUEST['school_id'];
$type = 2;

$status = 0;
$msg = "Unknown error!";

if ($date != null && $idno != null && $session != null && $month != null){
    $res = $db->getRow("SELECT * FROM attandenc WHERE date='$date' AND idno='$idno' AND type='$type' AND session='$session' AND month='$month'");

    $status = 1;
    if ($res && count($res) > 0){


        $period_array = json_decode($res['period']);
        $res['period'] = (($period_array == null) ? array() : $period_array);

    }else{
        $res = new stdClass();
        $msg = "sawee";
    }
}

echo json_encode(array("status"=>$status,"data"=>$res, "message"=>$msg));