<?php
    require_once __DIR__ . '/../DBConnect.php';

	try 
	{
			$stmt = $conn->prepare("SELECT * from Project");
			$stmt->execute();
			$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
		
		
	   if($result!=null &&  $result>0){
			$response["ProjectMenu"] = array();
			foreach($result as $row) { 
			
			  $Project["ProjectID"] =          $row["ProjectID"];
			  $Project["ProjectName"] =        $row["ProjectName"];
			  $Project["ProjectDescription"] = $row["ProjectDescription"];
			  $Project["ProjectType"] =        $row["ProjectType"];
			  $Project["CBEditCharges"] =      $row["CBEditCharges"];
			  $Project["CBEntryCharges"] =     $row["CBEntryCharges"];
			  $Project["BillEditCharges"] =    $row["BillEditCharges"];
			  $Project["BillEntryCharges"] =   $row["BillEntryCharges"];

			  // push single product into final response array
			  array_push($response["ProjectMenu"], $Project);
			}
			 // 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;
?>