<?php 
ob_start();
session_start();
include("inc/config.php");


 $pincode_id = $_POST['id'];
	$statement = $pdo->prepare("SELECT * FROM pincode where pin_code='$pincode_id'");
	$statement->execute();
	$result = $statement->fetchAll(PDO::FETCH_ASSOC);
	$count = $statement->rowCount();
	if($count > 0){
     foreach ($result as $row) {
            $pin_code = $row['pin_code'];
            $pin_id = $row['id'];
            $city = $row['city'];
            $state = $row['state'];
    if($row["service"]=="Yes"){$service ="<i class='fa fa-check-circle ' aria-hidden='true' style='font-size:24px;color:green;'></i>";}else{$service ="<i class='fa fa-times-circle ' aria-hidden='true' style='font-size:24px;color:red;'></i>";}
	if($row["air"]=="Yes"){$air ="<i class='fa fa-check-circle ' aria-hidden='true' style='font-size:24px;color:green;'></i>";}else{$air ="<i class='fa fa-times-circle ' aria-hidden='true' style='font-size:24px;color:red;'></i>";}
	if($row["road"]=="Yes"){$road ="<i class='fa fa-check-circle ' aria-hidden='true' style='font-size:24px;color:green;'></i>";}else{$road ="<i class='fa fa-times-circle ' aria-hidden='true' style='font-size:24px;color:red;'></i>";}
	if($row["b2b"]=="Yes"){$b2b ="<i class='fa fa-check-circle ' aria-hidden='true' style='font-size:24px;color:green;'></i>";}else{$b2b ="<i class='fa fa-times-circle ' aria-hidden='true' style='font-size:24px;color:red;'></i>";}
	if($row["b2c"]=="Yes"){$b2c ="<i class='fa fa-check-circle ' aria-hidden='true' style='font-size:24px;color:green;'></i>";}else{$b2c ="<i class='fa fa-times-circle ' aria-hidden='true' style='font-size:24px;color:red;'></i>";}
	if($row["oda"]=="Yes"){$oda ="<i class='fa fa-check-circle ' aria-hidden='true' style='font-size:24px;color:green;'></i>";}else{$oda ="<i class='fa fa-times-circle ' aria-hidden='true' style='font-size:24px;color:red;'></i>";}
            $status = 1;
    }
    $datas[] = array('pin_code' => $pin_code,'city' => $city,'state' => $state, 'service' => $service,'air'=> $air,'road'=> $road,'b2b' => $b2b,'b2c' => $b2c,'oda' => $oda,'status' => $status,'id'=>$pin_id);
    echo json_encode($datas);
    
	} else {
	    $status = 0;
	    
	    $datas[] = array('status' => $status);
                              
        echo json_encode($datas);
	}
?>