<?
session_start();
include("opendb.php");
include("test.php");
 $tbl="veh_master";


if(@$_GET['type']=='name')
{
$partname=$_GET['key'];


$re=mysqli_query($db,"select config,mcode from $tbl where config like '%$partname%' and brcode='$brcode'");


}
else
{
$partcode=$_GET['key'];
$re=mysqli_query($db,"select config,mcode from $tbl where config like '%$partcode%' and brcode='$brcode'");

}

$json="";
while($row=mysqli_fetch_array($re))
{
$cd=str_replace(' ','~',$row[0]);

	 $json.= '{"partcode":"'.$cd.'","partname":"'.addslashes($row[1]).'"},';

}

echo '['.trim($json,',').']';

?>
