<?php
include "dbconfig.php";
$link = opencon();


// $sql = "SELECT * FROM new_client_details where id!=''";

// $sql_exe = mysqli_query($link,$sql);


// $i=1;
// while($fetch_qr = mysqli_fetch_array($sql_exe)){
    
//     $id=$fetch_qr['id'];
//     $mobile=$fetch_qr['Phone1'];
//     $pre="0";
//     if($i>=10)
//     {
//         $pre="";
//     }
// $collection_id="CIF-".$pre.$i;

// $tablename="new_booking_details";

// $set="client_id='$collection_id'";

// $where="client_='$id'";

// $update="update $tablename set $set where $where";

// echo $update."<br>";

// mysqli_query($link,$update);

// $i++;
// }


$sql = "SELECT * FROM new_collection_details";

$sql_exe = mysqli_query($link,$sql);


$i=1;
while($fetch_qr = mysqli_fetch_array($sql_exe)){
    
    $id=$fetch_qr['id'];
    $mobile=$fetch_qr['client_mobile'];
    
    
    
   $sql1 = "SELECT * FROM new_booking_details where client_mobile='$mobile'";

$sql_exe1 = mysqli_query($link,$sql1);
$booking_id="";
$booking_date="";
$client_id="";
while($fetch_qr1 = mysqli_fetch_array($sql_exe1)){
    $booking_id=$fetch_qr1['booking_id'];
    $booking_date=$fetch_qr1['booking_date'];
    $client_id=$fetch_qr1['client_id'];
}
    
$collection_id=$fetch_qr['Cus_ID'];

$tablename="new_collection_details";

$set="client_id='$client_id',booking_id='$booking_id',booking_date='$booking_date'";

$where="id='$id'";

$update="update $tablename set $set where $where";

echo $update."<br>";

mysqli_query($link,$update);

$i++;
}









?>