After viewing 4 data I want to change a div's class. Suppose when it is 4 data the div will be after 4 data the div will be dynamically.
<div class="carousel-inner" role="listbox">
<?php
$i=0;
$sql = mysqli_query($con,"SELECT * FROM product WHERE featured = 'featured' ORDER BY id DESC");
while($row = mysqli_fetch_assoc($sql)){
if($i == 4){ echo '<div class="item active">';}
elseif($i != 4){ echo '<div class="item">'; }
?>
<div class="single-wid-product sel-pd">
<img src="admin/upload/<?php echo $row['file']; ?>" alt="" class="product-thumb">
</div>
</div>
<?php $i++; } ?>
</div>
In that picture it is a carousel. It has 4 items active. And the div is
<div class="item active">
<p>Item 1</p>
<p>Item 2</p>
<p>Item 3</p>
<p>Item 4</p>
</div>
When it's doing autoplay (for the rest products) the div is
<div class="item">
<p>Item 5</p>
<p>Item 6</p>
<p>Item 7</p>
<p>Item 8</p>
</div>
And for others the div is
<div class="item">
<p>Item 5</p>
<p>Item 6</p>
<p>Item 7</p>
<p>Item 8</p>
</div>
So I want to make to merge all those divs. For the first 4 items the div class will be "item active" and for the rest items the class will be "item". It will be changed dynamically.
