<?php
    include'connection.php';
    
        $query1="select * from retailer";
		$result1=mysqli_query($con,$query1);
		while($row=mysqli_fetch_array($result1))
		{
		        $RetlrId=$row['Userid'];
			    $quGetLiveBal="select Balance from wallet where Userid='$RetlrId' order by Id desc";
			    $reGetLiveBal=mysqli_query($con,$quGetLiveBal);
			    $dataGetLiveBal=mysqli_fetch_array($reGetLiveBal);
			    $LiveBal=$dataGetLiveBal['Balance'];
			    
			    $update="update retailer set Balance='$LiveBal' where Userid='$RetlrId'";
			    mysqli_query($con,$update);
		    
		}
		
		echo "Updated";

?>