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

$session = $_GET['session'];
//$checkdate = $db->getRows("select * from calendar WHERE session='$session'");

// while ($rowc = mysql_fetch_assoc($checkdate))

/*

foreach($checkdate as $rowc)
{
    $jsonn[] = $rowc;
}

if (count($jsonn) > 0) {
    $status = 1;
    $msg = "Data found successfully.";
} else {
    $msg = "Something went wrong. Please try again.";
}

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

*/

$status = 0;
$msg = "Unable to fetch data..! Please retry later";
$data = array();

$checkdate = $db->getRows("select * from calendar WHERE session='$session'");

$status = 1;

if (count($checkdate) > 0){
    $msg = "Record found";
    $data = $checkdate;
}else{
    $msg = "Record not found";
}

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