<?php
// include db connect class
	require_once __DIR__ . '/../DBConnect.php';
	//if (isset($_POST['SessionDate'])) {
        $SessionDate = $_POST['SessionDate'];
 			$sql = "SELECT * FROM Chat2Receiver WHERE UpdatedDate >= '$SessionDate'";
//            $sql = "SELECT * FROM Chat2Receiver";

			$stmt = $conn->prepare($sql);
			$stmt->execute();
			$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
			   
		   if($result!=null &&  $result>0){
					  $response["Chat2Receiver"] = array();
			 foreach($result as $row) { 
					        
				$Chat2Receiver["MessageID"] = $row["MessageID"];  
				$Chat2Receiver["ReceiverID"] = $row["ReceiverID"];  
				$Chat2Receiver["ReceiverMobileNo"] = $row["ReceiverMobileNo"];     
				$Chat2Receiver["ReceiveTime"] = $row["ReceiveTime"];    
				$Chat2Receiver["ReadTime"]=$row["ReadTime"];		
				$Chat2Receiver["SenderMobieNo"] = $row["SenderMobieNo"];
				$Chat2Receiver["NetCode"] = $row["NetCode"];                                            
				$Chat2Receiver["SysCode"] = $row["SysCode"];                                            
				$Chat2Receiver["UpdatedDate"] = $row["UpdatedDate"];             
				$Chat2Receiver["ReceiverStatus"]=$row["ReceiverStatus"];
				  // push single product into final response array
				  array_push($response["Chat2Receiver"], $Chat2Receiver);
			  }
			  // success
			  $response["success"] = 1;
			  // echoing JSON response
			  echo json_encode($response);
		}else {
		  // success
		  $response["success"] = 0;
		  $response["message"] = "No Data Availaible";
		  // echoing JSON response
		  echo json_encode($response);
		}
//   }else {
//         // success
//         $response["success"] = 0;
//         $response["message"] = "No Data Availaible";
//         // echoing JSON response
//     		echo json_encode($response);
// 	}
?>
