<?
session_start();
include_once("../../test.php");
include_once ("../../opendb.php");
$brcode=$_SESSION['brcode'];
$user=$_SESSION['user'];
$ledg=trim($_REQUEST['cd']);
$led='';
for ($ctr=0;$ctr<=strlen($ledg);$ctr++)
{
      if(substr($ledg,$ctr,1)!=' ')
          $led.=substr($ledg,$ctr,1);
}
//print "select * from ledger where replace(led,' ','')='$led' and (brcode='$brcode' )";
$result=mysqli_query($db,"select led from ledger where replace(led,' ','')='$led' and (brcode='$brcode' )");
$row1=mysqli_fetch_array($result)or die('Leger '.$ledg.' does not belong to this branch'.mysqli_error($db));
print $row1[0];
print "update journal2 set partic = '$row1[0]' where replace(partic,' ','')='$led' and (brcode='$brcode' )";
$result=mysqli_query($db,"update journal2 set partic = '$row1[0]' where replace(partic,' ','')='$led' and (brcode='$brcode' )");
$row=mysqli_fetch_array($result)or die('Ledger '.$ledg.' does not belong to this branch'.mysqli_error($db));
header('location:missled1.php');
?>

