<?
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='inde.php'; </script>";
 return;
}
$tbl2="prod_invoice";
$inno=$_GET['key'];

$re=mysqli_query($db,"select * from $tbl2 where invno like '%$inno%' and brcode='$brcode' limit 10 ") or die("ERR6:".mysqli_error($db));
$json="";
while($row=mysqli_fetch_array($re))
{

$json.= '{"inno":"'.$row[0].'","partname":"'.addslashes($row[5]).'","stock":"'.addslashes($row[4]).'","rate":"'.addslashes($rw1[0]).'","reduct":"'.addslashes($row[10]).'","tax":"'.addslashes($rw[0]).'"},';

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