
<?php


    
    require_once __DIR__ . '/../DBConnect.php';
	try 
	{
	
		
		
			$stmt = $conn->prepare("SELECT * from ProjectMenu");
			$stmt->execute();
			$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
		
		
	   if($result!=null &&  $result>0){
			$response["ProjectMenu"] = array();
			foreach($result as $row) { 
			
			 $ProjectMenu["MenuID"] = $row["MenuID"];
			  $ProjectMenu["ProjectID"] = $row["ProjectID"];
			  $ProjectMenu["MenuGroup"] = $row["MenuGroup"];
			  $ProjectMenu["MenuName"] = $row["MenuName"];
			  $ProjectMenu["PageOpen"] = $row["PageOpen"];
			  $ProjectMenu["ValuePass"] = $row["ValuePass"];
			  $ProjectMenu["ImageName"] = $row["ImageName"];
			  $ProjectMenu["GroupSortBy"] = $row["GroupSortBy"];	
			  $ProjectMenu["SortBy"] = $row["SortBy"];

			  // push single product into final response array
			  array_push($response["ProjectMenu"], $ProjectMenu);
			}
			 // 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);
				
			}
	}
	catch(PDOException $e){
		
		echo "Error: " . $e->getMessage();
		
	}
  $conn = null;
?>