<?php
// array for JSON response
  $response= array();

    // include db connect class
   require_once __DIR__ . '/../DBConnect.php';

if(isset($_POST['ClientID'])){
	
	$ClientID = $_POST['ClientID'];

      $sql = "SELECT * FROM Restaurant2Table WHERE ClientID = $ClientID";
     $stmt = $conn->prepare($sql);
			$stmt->execute();
			$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
	if($result!=null &&  $result>0){
        $response["Restaurant2Table"] = array();
       foreach($result as $row) {
             
		$Restaurant2Table["ID"] = $row["ID"];
		$Restaurant2Table["TableID"] = $row["TableID"]; 		
		$Restaurant2Table["PotionID"] = $row["PotionID"];
		
		$Restaurant2Table["TableDescription"] = $row["TableDescription"];
		$Restaurant2Table["TableStatus"] = $row["TableStatus"];
  		$Restaurant2Table["ClientID"] = $row["ClientID"];
  		$Restaurant2Table["ClientUserID"] = $row["ClientUserID"];
  		$Restaurant2Table["NetCode"] = $row["NetCode"];
  		$Restaurant2Table["SysCode"] = $row["SysCode"];
        $Restaurant2Table["UpdatedDate"] = $row["UpdatedDate"]; 
		$Restaurant2Table["SalPur1ID"] = $row["SalPur1ID"]; 
		$Restaurant2Table["TableName"] = $row["TableName"]; 
		
          // push single product into final response array
          array_push($response["Restaurant2Table"], $Restaurant2Table);
        }
        // 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);
      }
?>
