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!