<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Log on Load</title>
</head>
<body>
    
    <?php 
    
    ini_set('display_errors', 1);
    ini_set('display_startup_errors', 1);
    error_reporting(E_ALL);
    
    $conn= mysqli_connect("localhost","tradebot_pilot","tradebot@123","tradebot_pilot");
    if (mysqli_connect_errno()) {
      echo "Failed to connect to MySQL: " . mysqli_connect_error();
      exit();
    }

    $get_trade=mysqli_query($conn,"select * from api_trade_history group by trade_process_id order by trade_process_id");
    
    while($row=mysqli_fetch_array($get_trade))
    {
         $userid=$row['uuserid'];
         $get_trade_info=mysqli_fetch_array(mysqli_query($conn,"select * from trade_process where id='".$row['trade_process_id']."'"));
         
         if($get_trade_info['uusersid']!=$userid)
         {
            echo $get_trade_info['id'];
            mysqli_query($conn,"update trade_process set uusersid='".$userid."' where id='".$get_trade_info['id']."'");
            echo "<br>";
         }
         
         
        
    }
    

     
?> 
