I have the following code:
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
</ol>
<?php
include 'conexao.php';
$consulta = $PDO->query("SELECT * FROM imoveis WHERE id='$imovelid';");
while ($linha = $consulta->fetch(PDO::FETCH_ASSOC)) {
$pasta = "painel/galeria/$linha[fotos]/";
$imagens = glob("$pasta/{*.jpg,*.JPG,*.png,*.PNG}",GLOB_BRACE);
foreach($imagens as $img){ ?>
<div class="carousel-inner">
<div class="item active">
<img src="<?php echo $img ?>" alt="<?php echo "$linha[titulo]"; ?>">
</div>
<div class="item">
<img src="<?php echo $img ?>" alt="<?php echo "$linha[titulo]"; ?>">
</div>
</div>
<? } } ?>
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
<span class="sr-only">Next</span>
</a>
</div>
When generating the slider with the images coming from the folder, which is previously registered in a field of the database, my result is as follows:
Images are stacked, instead of passing them one at a time.
I've tried changing the location of opening and closing div's, but I have not had much success.
Any tips?