<?php
$id = $_COOKIE["auth_id"];
require ("../connect.php");
$query_lobby = mysqli_query($connection, "SELECT * FROM lobby WHERE id_taker='$id' and status = 1");
while($row_send = mysqli_fetch_assoc($query_lobby)){
$query = "SELECT * FROM users WHERE id='".$row_send['id_sender']."'";
$result = mysqli_query($connection, $query) or die(mysqli_error($connection));
$row = $result->fetch_assoc();
$sender_name = $row['username'];
$sender_id = $row['id'];
$sender_avatar = $row['avatar'];
print_r("$sender_id")
echo '
<div class="accountFriendlist" style="justify-content:center; display:flex;">
<div class="friendsList" style="width:500px;">
<div class="friend">
<div class="friendInfo" style="cursor:auto;">
'.if (isset('.$row['avatar'].')) {.'
<div class="avatar" style="width:75px;height:75px"><img style="width: 75px;
height: 75px; border-radius: 50%;" src="/avatars/'.$sender_avatar.'" alt=""></div>
'.} else {.'
<div class="avatar">'.printf($sender_name[0]).'</div>
'. } . '
<div class="nickname">
'.$sender_name.' id'.$sender_id.'
</div>
<div class="inviteDate" style="padding-left:10px;">
'.$row_send['date'].'
</div>
</div>
<div class="actions" style="cursor: pointer;">
<div class="acceptLobby"> <a style="font-weight: 600;
font-size: 18px;
color: #4994e1;
cursor: pointer;
text-align: center;" onclick="acceptLobby('.$sender_id.', '.$id.');">
<i class="fas fa-plus"></i>Join</a> </div>
<div class="cancelLobby">
<a style="
font-weight: 500;
font-size: 12px;
opacity: .5;
letter-spacing: 1.5px;
text-transform: uppercase;
color: #4994e1;
cursor: pointer;
text-align: center;" onclick="cancelLobby('.$sender_id.', '.$id.');">Cancel</a></div>
</div>
</div>
</div>
</div>'
?>
<?php
$id = $_COOKIE["auth_id"];
require("../connect.php");
$query_lobby = mysqli_query($connection, "SELECT * FROM lobby WHERE id_taker='$id' and status = 1");
while ($row_send = mysqli_fetch_assoc($query_lobby)){
$query = "SELECT * FROM users WHERE id='" . $row_send['id_sender'] . "'";
$result = mysqli_query($connection, $query) or die(mysqli_error($connection));
$row = $result->fetch_assoc();
$sender_name = $row['username'];
$sender_id = $row['id'];
$sender_avatar = $row['avatar'];
print_r("$sender_id");
?>
<div class="accountFriendlist" style="justify-content:center; display:flex;">
<div class="friendsList" style="width:500px;">
<div class="friend">
<div class="friendInfo" style="cursor:auto;">
<?php
if (isset($row['avatar'])) { ?>
<div class="avatar" style="width:75px;height:75px"><img style="width: 75px;
height: 75px; border-radius: 50%;" src="/avatars/'.$sender_avatar.'" alt=""></div>
<?php
} else { ?>
<div class="avatar"><?php
printf($sender_name[0]) ?></div>
<?php } ?>
<div class="nickname">
<?= $sender_name?> id <?= $sender_id?>
</div>
<div class="inviteDate" style="padding-left:10px;">
<?= $row_send['date']?>
</div>
</div>
<div class="actions" style="cursor: pointer;">
<div class="acceptLobby"><a style="font-weight: 600;
font-size: 18px;
color: #4994e1;
cursor: pointer;
text-align: center;" onclick="acceptLobby(<?= $sender_id?>, <?= $id?>);">
<i class="fas fa-plus"></i>Join</a></div>
<div class="cancelLobby">
<a style="
font-weight: 500;
font-size: 12px;
opacity: .5;
letter-spacing: 1.5px;
text-transform: uppercase;
color: #4994e1;
cursor: pointer;
text-align: center;" onclick="cancelLobby(<?= $sender_id?>, <?= $id?>);">Cancel</a></div>
</div>
</div>
</div>
</div>
<?php } ?>