<?php



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

    // include db connect class
    require_once __DIR__ . '/../DBConnect.php';
	try {
	
		$stmt = $conn->prepare("SELECT * FROM Item1Type");
		$stmt->execute();
		$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
	   if($result!=null &&  $result>0){
			  $response["Item1Type"] = array();
			foreach($result as $row) { 
			
		    $Item1Type["Item1TypeID"] = $row["Item1TypeID"];
			$Item1Type["ItemType"] = $row["ItemType"];

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