@RandomNick228

Ошибка в строке?

Parse error: syntax error, unexpected 'echo' (T_ECHO) in C:\xampp\htdocs\lobby\updateInvitesList.php on line 15

<?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>'
                           
                        
    ?>
  • Вопрос задан
  • 116 просмотров
Решения вопроса 1
Compolomus
@Compolomus Куратор тега PHP
Комполом-быдлокодер
<?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 } ?>


как то так, исправил
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы