<?php
/*
$hostname = 'localhost';
$username = 'root';
$password = '';*/
$hostname = 'localhost';
$username = 'nwpgis';
$password = 'Anaconda@';

$dbacc = mysql_connect($hostname, $username, $password);
$dbinv = mysql_connect($hostname, $username, $password, true);

//$ben = mysql_connect($hostname, $username, $password);
//$ben_tyre = mysql_connect($hostname, $username, $password, true);
/*
if ($_SESSION['COMCODE']=="A"){
	mysql_select_db('nwpgis_pt_acca');
} else if ($_SESSION['COMCODE']=="B"){
	mysql_select_db('nwpgis_pt_accb');
} else if ($_SESSION['COMCODE']=="C"){
	mysql_select_db('nwpgis_pt_accc');
}
*/
mysql_select_db('nwpgis_pt_acca');
mysql_select_db('nwpgis_pt', $dbinv);

 $sql = "select * from s_invcheq where trn_type='REC-A' and Sdate>='2015-05-01'";
 //echo $sql;
 $result = mysqli_query($GLOBALS['dbinv'],$sql);
 while ($row = mysqli_fetch_array($result)){
 
 	$sql1="update recmas set l_date='".$row["che_date"]."' where l_refno='".$row["refno"]."'";
	$result1 = mysqli_query($GLOBALS['dbacc'],$sql1);
	
	$sql1="update ledger set l_date='".$row["che_date"]."' where l_refno='".$row["refno"]."'";
	$result1 = mysqli_query($GLOBALS['dbacc'],$sql1);
	
	
 
 }

 

?>