<?
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 ledger where led like '%$inno%' and brcode='$brcode' order by led asc limit 10") or die("ERR6:".mysqli_error());

$json="";
while($row=mysqli_fetch_array($re))
{

$json.= '{"led":"'.$row[0].'","partname":"'.addslashes($row[2]).'"},';

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

?>