How do I know the online status of each member? Please change the code by "I".

I am writing hard

$data = $pdo->query(
          "SELECT * FROM `user` "
        );
        $data2 = $pdo->query(
          "SELECT * FROM `user` "
        );

where to display

<? while($row = mysqli_fetch_array($data)){ ?>
<div class="user-<?=$row["id"];?>"></div>

jquery and backend
this is at the bottom of the network, because my jquery account is below
or he will say that he can"t find $
, so

<script src="jquery.js"></script>

<? while($row = mysqli_fetch_array($data2)){ ?>

  <script>
  online_status_<?=$row["id"];?>();
  function online_status_<?=$row["id"];?>(){
    $(".user-<?=$row["id"];?>").load("/notify?type=xxx&id=<?=$row["id"];?>", function(data){
      $(".user-<?=$row["id"];?>").html(data);
    });
    setTimeout(online_status_<?=$row["id"];?>, 10000);
  };
  </script>
<?}?>

backend

$data = $pdo->query(
      "SELECT * FROM `user`
      WHERE
        `id` = "{$_GET["id"]}" "
    );
    if(mysqli_num_rows($data)!=0){

      $row = mysqli_fetch_array($data);
      if(time()-$row["online_status"] > 20){
        echo "";
      }else{
        echo "";
      }
    }
The

user number table has an online_status bit
I update this bit every ten seconds, stamped with a timestamp.
is here to determine whether the upper and lower lines if (time ()-$row ["online_status"] > 20) {
this way is strangely feasible, but definitely not feasible!
but I want to find the Great God. I"ll see how to change the code!

Apr.09,2021

I've solved it.


members go online to change their status, and then add heartbeat detection!

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37af6-2c0ad.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37af6-2c0ad.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?