Класс Active первому результату запроса
Нужно первому элементу запроса добавлять класс Active в div . Перерыл весь Stackoverflow - ничего не подходит под мой случай.
<?php
$sql_item_for_shop = mysqli_query($link, "SELECT * FROM phones_item WHERE hide!='1' AND id!='$row[id]' AND main_page_show='1' ORDER BY rand() LIMIT 8");
while ($row_item_for_shop = mysqli_fetch_assoc($sql_item_for_shop)) {
$options_sum = 0;
$sql_device_for_item = mysqli_query($link, "SELECT device_path FROM phones_device WHERE id='$row_item_for_shop[device]'");
$row_device_for_item = mysqli_fetch_assoc($sql_device_for_item);
echo "
<div class='carousel-item' style='$row_item_for_shop[background_custom]'>
<div class='container-fluid d-flex vh-100 align-items-center'>
<div class='d-block w-100 text-light'>
<div class='row'>
<div class='col-12 col-lg-6'>
<a href='/phones/$row_item_for_shop[alias]/' title='$row_item_for_shop[name]'>
<img class='img-fluid d-block mx-auto' style='max-height:70%;' src='/uploads/images/collections/$row_device_for_item[device_path]/$row_item_for_shop[alias]/large-$row_item_for_shop[normal_image]' title='$row_item_for_shop[name] — $row_item_for_shop[short_description]' alt='$row_item_for_shop[name] — $row_item_for_shop[short_description]'>
</div>
<div class='col-12 col-lg-6'><p class='mt-4 mb-1 weight-700 text-uppercase'><a class='text-dark' href='/phones/$row_item_for_shop[alias]/' title='$row_item_for_shop[name]'>$row_item_for_shop[name]</a></p>
<p class='weight-500 text-uppercase'>".$price_text."</p></div>
</div>
</div>
</div>
</div>
";
}
?>```