setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch(PDOException $e) { echo "ERROR : ".$e->getMessage(); } $term=$_GET["term"]; $stmt = $DBcon->prepare("SELECT * FROM stall_details where en_no like '%".$term."%' order by en_no"); $stmt->execute(); $json=array(); while($row=$stmt->FETCH(PDO::FETCH_ASSOC)) { $json[]=array( 'value'=> $row["en_no"], 'label'=>$row["regno"]." - ".$row["en_no"] ); } echo json_encode($json); ?>