<?php

// array for JSON response
$response = array();

//check for required fields
if (isset($_POST['Account3ID'])) {

      $Account3ID = $_POST['Account3ID'];

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

      $UpdatedDate = date("Y-m-d H:i:s");

      $sql = "SELECT * FROM Account4UserRights WHERE Account3ID = $Account3ID";
      $params = array();
      $stmt = $conn->prepare($sql);
			$stmt->execute();
			$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
	if($result!=null &&  $result>0){
        $response["Account4UserRights"] = array();
       	foreach($result as $row) { 
          $Account4UserRights["AcRightsID"] = $row["AcRightsID"];
          $Account4UserRights["Account3ID"] = $row["Account3ID"];
          $Account4UserRights["MenuName"] = $row["MenuName"];
          $Account4UserRights["PageOpen"] = $row["PageOpen"];
          $Account4UserRights["ValuePass"] = $row["ValuePass"];
          $Account4UserRights["ImageName"] = $row["ImageName"];
          $Account4UserRights["Inserting"] = $row["Inserting"];
          $Account4UserRights["Edting"] = $row["Edting"];
          $Account4UserRights["Deleting"] = $row["Deleting"];
          $Account4UserRights["Reporting"] = $row["Reporting"];
          $Account4UserRights["ClientID"] = $row["ClientID"];
          $Account4UserRights["ClientUserID"] = $row["ClientUserID"];
          $Account4UserRights["NetCode"] = $row["NetCode"];
          $Account4UserRights["SysCode"] = $row["SysCode"];
          $Account4UserRights["UpdateDate"] = $row["UpdateDate"];
          $Account4UserRights["SortBy"] = $row["SortBy"];


          // push single product into final response array
    			array_push($response["Account4UserRights"], $Account4UserRights);
        }
        // success
    		$response["success"] = 1;
        // echoing JSON response
    		echo json_encode($response);
      }else {
        $response["success"] = 0;
        $response["message"] = "Data Not Available";
		  echo json_encode($response);
      }
    }else {
      $response["success"] = 0;
      $response["message"] = "Please Send Account3ID";
	echo json_encode($response);
    }
?>
