<?
session_start();
include_once('opendb.php');
$brcode=$_SESSION['brcode'];
$user=$_SESSION['user'];
$tbl2="partmaster";
$partcode_1=$_GET['key'];
if(isset($_GET['type'])=='name')
{

  $re=mysqli_query($db,"select * from $tbl2 where partname like '%$partcode_1%' limit 10 ") or die("ERR6:".mysqli_error($db));
}
else
{
  $re=mysqli_query($db,"select * from $tbl2 where partcode like '%$partcode_1%' order by partcode asc limit 10") or die("ERR6:".mysqli_error($db));
}
print "select * from $tbl2 where partcode like '%$partcode%' order by partcode asc limit 10";
$json="";
while($row=mysqli_fetch_array($re))
{
	$json.= '{"partcode_1":"'.$row[0].'","partname":"'.addslashes($row[1]).'"},';

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