
<?php 
date_default_timezone_set("Asia/Calcutta");
require 'db.php';
 	$cp = array(); 
 		$p = array();
    $current_time = date("H:i");
    $cur_start_time = date("H:i");
    $val = "select * from category where TIME_TO_SEC(catstarttime) < TIME_TO_SEC($current_time) and TIME_TO_SEC(catstoptime) > TIME_TO_SEC($current_time) and catstatus='1' limit 6";
    $sels = $con->query("select * from category where catstatus='1' limit 6");
    if($rows = $sels->fetch_assoc())
    {
        $current_time = date("H:i");
        $cur_start_time = $rows['catstarttime'];
        $cur_stop_time = $rows['catstoptime'];
        if(strtotime($current_time) > strtotime($cur_start_time) && strtotime($current_time) < strtotime($cur_stop_time))
        {
            $p['id'] = $rows['id'];
    		$p['catname'] = $rows['catname'];
    		$p['catimg'] = $rows['catimg'];
    		$p['count'] = $con->query("select * from subcategory where cat_id=".$rows['id']."")->num_rows;
    		$cp[] = $p;
        }
    }

	$returnArr = array("ResponseCode"=>strtotime($current_time),"Result"=>strtotime($cur_start_time),"ResponseMsg"=>$val);
    echo json_encode($returnArr);
?>