<?
session_start();
include_once('opendb.php');
$brcode=$_SESSION['brcode'];
$user=$_SESSION['user'];
if(strlen($brcode)<=0)
{
 print "<script> alert('Session timed out'); parent.document.location='index.php'; </script>";
 return;
}
$inno=$_GET['key'];
$re=mysqli_query($db,"select * from sup_master where supname like '%$inno%' and branch='$brcode' and tin!='' order by supname asc limit 10") or die("ERR6:".mysqli_error());
$json="";
while($row=mysqli_fetch_array($re))
{

$json.= '{"supnm":"'.$row['supname'].'","partname":"'.addslashes($row['tin']).'","stock":"'.addslashes($row['dist1']).'","rate":"'.addslashes($row['state1']).'"},';

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