There are two tables, comments and users. They are related. It is necessary to obtain data from both tables in a single query. I make such a request
$Result = mysqli_query($CONNECT, 'SELECT comments.id, comments.added, comments.date, comments.text, users.id, users.fname, users.lname, users.avatar, users.login FROM comments, users ORDER BY comments.id DESC'); And bring:
while ($Row = mysqli_fetch_assoc($Result)) { echo ' <h6 class="comment__name"> <a href="/users/'.$User['login'].'">'.$Row['fname'].' '.$Row['added'].' '.$Row['lname'].'</a></h6> <span>'.$Row['date'].'</span> <div class="comment__content">'.$Row['text'].'</div> ';} The problem is this: the same string while displays 2 times.
Thanks Mike for the tip, the solution:
$Result = mysqli_query($CONNECT, ('SELECT comments.id, comments.added, comments.date, comments.text, users.id, users.fname, users.lname, users.avatar, users.login FROM comments, users WHERE comments.added = users.login ORDER BY comments.id DESC'));