<?php $comments = mysqli_query($connection, "SELECT * FROM `comments` WHERE `articles_id` = " . (int)$art['id'] . "ORDER BY `id` DESC");
if( mysqli_num_rows($comments) <= 0)
{
echo "Нет комментариев!";
}
while( $comment = mysqli_fetch_assoc($comments) )
{
?>
<article class="article">
<div class="article__image" style="background-image: url( https://www[dot]gravatar[dot]com/avatar/<?php echo md5($comment['email']);?>?s=125);"></div>
<div class="article__info">
<a href="/article.php?id=<?php echo $comment['articles_id']; ?>"><?php echo $comment['author']; ?></a>
<div class="article__info__meta"></div>
<div class="article__info__preview"><?php echo mb_substr(strip_tags($comment['text']), 0, 100, 'utf-8') . ' ... '; ?></div>
</div>
</article>
<?php
}
?>
|