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

$searchText = $_POST['search'];
   	$statement = $pdo->prepare("SELECT * FROM `pincode` WHERE pin_code like '%".$searchText."%' OR city like '%".$searchText."%' order by id asc limit 10");
									$statement->execute();
									$result = $statement->fetchAll(PDO::FETCH_ASSOC);
									$count = $statement->rowCount();
									 $search_arr = array();
                                     foreach ($result as $row) 
                                     {
                                            $id = $row['id'];
                                            $pin_code = $row['pin_code'];
                                            $city = $row['city'];
                                            $search_arr[] = array("id" => $id, "pin_code" => $pin_code, "city" => $city);
                                     } 
                                    echo json_encode($search_arr);
?>