<?php

        include('../config/config.php');
        date_default_timezone_set('Africa/Lagos');
        
        
        // include ('/messaging/whatsapp/index.php');
        
        
        
          $select_user = mysqli_query($link, "SELECT * FROM `Users` WHERE  DeleteStatus='0' 
                           AND Phone = '' ORDER BY UserFirstName ASC");
                            $select_user_cnt = mysqli_num_rows($select_user);
                            
                            $select_user_cnt_row = mysqli_fetch_assoc($select_user);
                           
                            $prosload_user_array = [];
                           
                           if($select_user_cnt > 0)
                           {
                               
                               
                               
                                   do{
                                       
                                       
                                       
                                       
                                         $Phone = $select_user_cnt_row['Phone'];
                                         $UserID = $select_user_cnt_row['UserID'];
                                       
                                       
                                       $_select_cnt = mysqli_query($link, "SELECT * FROM `userlogin` WHERE UserID='$UserID'");
                                       $_select_cnt_row_row = mysqli_fetch_assoc($_select_cnt);
                                       
                                       
                                      $UserName =  $_select_cnt_row_row['UserName'];
                                       
                                       $insert_update = mysqli_query($link, "UPDATE `Users` SET Phone='$UserName' WHERE UserID='$UserID'");

                                        
                                       
                                       if($insert_update == true)
                                       {
                                          
                                          echo 'success';
                                       }else
                                       {
                                           
                                           
                                           echo 'failed';
                                       }
                                       
                                       
                                       
                                   }while( $select_user_cnt_row = mysqli_fetch_assoc($select_user));
                              
                              
                           }
        
        
        
      
      
  ?>