<?php
error_reporting(0); //7dec25
if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); else ob_start();
session_start();
session_cache_limiter('private');
$cache_limiter 	= session_cache_limiter();
session_cache_expire(60);
$cache_expire 	= session_cache_expire(); 
date_default_timezone_set('Asia/Manila'); 
$CURRENT_DATE 	= date('Y-m-d H:i:s');
include_once('../config/minho.php');
include_once('../config/autoloadClass.php');
$autoload	=	new autoloadClass();
$mecon		=	new condbClass();
$main		=	array();
$main2		=	array();
$arr3		=	array();
$main3		=	array();
$main4		=	array();
$mainId		=	(isset($_POST['mainid']))	?	$_POST['mainid']	:	"";
$mecon->query("SELECT cu.UnitId as UnitId, cu.Road as Road, cu.SideWalkGutter as SideWalkGutter, cu.Meralco as Meralco, cu.Water as Water, cu.HouseConstruction as HouseConstruction, cu.HouseConstructionPercentage as HouseConstructionPercentage, u.Block as Block, u.Lot as Lot  FROM units u LEFT JOIN construction_and_utilities cu ON u.id=cu.UnitId  WHERE u.Id = :id "); 
$mecon->bind(':id', $mainId);
$main = $mecon->resultset(); 
$counter = count($main); 
$arr1 = array(); 
$arr2 = array(); 
$arr3 = array(); 
for($a=0; $a<$counter; $a++){ 
		$arr1['id']					= $main[$a]['UnitId'];
		$arr1['block']				=  trim(stripslashes(html_entity_decode($main[$a]['Block']))); 
		$arr1['lot']				=  trim(stripslashes(html_entity_decode($main[$a]['Lot']))); 
		$arr1['road']				=  trim(stripslashes(html_entity_decode($main[$a]['Road']))); 
		$arr1['side_walk_gutter']   =  trim(stripslashes(html_entity_decode($main[$a]['SideWalkGutter']))); 
		$arr1['meralco'] 			=  trim(stripslashes(html_entity_decode($main[$a]['Meralco']))); 
		$arr1['water']				=  trim(stripslashes(html_entity_decode($main[$a]['Water']))); 
		$arr1['house_construction'] =  trim(stripslashes(html_entity_decode($main[$a]['HouseConstruction']))); 
		$arr1['house_construction_percentage'] =  trim(stripslashes(html_entity_decode($main[$a]['HouseConstructionPercentage']))); 

	$arr2[] = $arr1;
}
$arr3['data'] = $arr2;
echo json_encode($arr3); 
exit();
ob_end_flush();