<? 
session_start();
include("test.php");
include("opendb.php");
if(strlen($user)<=0)
{
  print "<script> alert('Invalid User'); document.location='inde.php' </script>";
  return;
}

if($ledg!='')
{
 $sql=mysqli_query($db,"select newpartmaster.partcode,newpartmaster.partname  from newpartmaster INNER JOIN spareprmast on newpartmaster.partcode=spareprmast.partcode where spareprmast.brcode='$brcode' and newpartmaster.partcode like '%$ledg%' order by newpartmaster.partcode asc limit 10") or die("ERR6:".mysqli_error($db));

}
else
{
//$sql=mysqli_query($db,"select distinct(led) from ledger where brcode='$brcode' order by led asc") or die("ERR6:".mysqli_error($db)); 
}

?>

<?
while($row=mysqli_fetch_array($sql))
{
?>

<option value='<? echo $row[partcode] ?>'>
<?
}
?>