<?php ob_start();
include("config.php");


 $dresult=mysql_query("select * from restaurant_chalan order by id asc");
$drow=mysql_fetch_array($dresult);


do{
	
$adresult=mysql_query("select bill_id from bill WHERE customer_id='$drow[client_id]' order by cdate desc limit 1");
$adrow=mysql_fetch_array($adresult);

 echo "UPDATE restaurant_chalan SET hbill_id='$adrow[bill_id]'  where id='$drow[id]'<br>";
 
mysql_query("UPDATE restaurant_chalan SET hbill_id='$adrow[bill_id]'  where id='$drow[id]'");

}while($drow=mysql_fetch_array($dresult));
 
?> 