$db->Query("SELECT * FROM db_news WHERE cat_id = '$catid' ORDER BY id DESC");//
if($db->NumRows() > 0){
while($news = $db->FetchArray()){
$textfull = $news["news"];
<div class="col">
<div class="accordion" id="accordionNews">
<div class="card mb-4 shadow-sm" id="heading<?=$news["id"];?>">
<div class="d-flex justify-content-between align-items-center">
<div class="new-title"><?=$news["title"]; ?> </div>
<small class="text-muted" style="padding-right: 20px;"><?=date("d.m.Y",$news["date_add"]); ?></small>
</div>
<div id="carousel<?=$news["id"];?>" class="carousel slide">
<ol class="carousel-indicators">
<li data-target="#carousel<?=$news["id"];?>" data-slide-to="0" class="active"></li>
<li data-target="#carousel<?=$news["id"];?>" data-slide-to="1"></li>
<li data-target="#carousel<?=$news["id"];?>" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
$db->Query("SELECT * FROM db_news_img WHERE news_id = '$news[id]' ORDER BY id DESC");//
if($db->NumRows() > 0){
while($img = $db->FetchArray()){
<div class="carousel-item active">
<img src="/<?=$img["link_img"]; ?>" class="d-block w-100 cover" alt="...">
</div>
}
</div>
<a class="carousel-control-prev" href="#carousel<?=$news["id"];?>" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carousel<?=$news["id"];?>" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
<div class="card-body">
<div id="collapse<?=$news["id"];?>" class="collapse" aria-labelledby="heading<?=$news["id"];?>" data-parent="#accordionNews">
<?=$textfull?>
</div>
<div class="d-flex justify-content-between align-items-center">
<button role="button" class="btn btn-sm btn-primary" data-toggle="collapse" data-target="#collapse<?=$news["id"];?>" aria-expanded="false" aria-controls="collapse<?=$news["id"];?>">Подробно</button>
<form action="" method="post">
<small class="text-muted"><?=$news["new_like"]; ?>
<input type="hidden" name="like" value="<?=$news["id"];?>" />
<button class="btn btn-link" style="color: red;" type="submit"><i class='fa fa-heart'></i></button>
</small>
</form>
</div>
</div>
</div>
</div>
</div>
}
$db_res1 = $db->Query("SELECT * FROM db_news WHERE cat_id = '$catid' ORDER BY id DESC");//
if($db_res1->NumRows() > 0){
while($news = $db_res1->FetchArray()){
$textfull = $news["news"];
$db_res2 = $db->Query("SELECT * FROM db_news_img WHERE news_id = '$news[id]' ORDER BY id DESC");//
if($db_res2->NumRows() > 0){
while($img = $db_res2->FetchArray()){