5
I have an "upload of files" and I needed to show them on a Carousel. The image path is stored in the database and the images in a folder, of course. I have the following code:
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
<li data-target="#myCarousel" data-slide-to="3"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<?php
$con = mysqli_connect("localhost","root","","saber");
mysqli_set_charset($con,"utf-8");
$result = mysqli_query($con,"select * from banners");
while($row = mysqli_fetch_array($result)){
$img = $row['imagem'];
echo "<div class='item active'>
<img src='php/$img'>
</div>";
}
?>
</div>
<!-- Left and right controls -->
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
And when I go to test the images appear one below the other. And I can’t see what the error is!
I went to get the code for the crash here and Carousel should be as shown in the example of the link I mentioned above, but it is like this:
I really need to get this done today and since I’ve never worked with Carousel in php and database. So I’ll put the whole page code.
And at Ricardo’s request here remains the html rendered
PS: I didn’t do this so I may not be able to answer all the questions they have.
What plugin generates this carrosel, post a page print like this and how it should be
– Ricardo
@I’ve already edited and I think I’ve shown you everything you asked for
– Bruno Gibellino
(off-topic) think it is not necessary to use the code display snippet in case of your question because when we run we do not see the actual result
– Ricardo
Copy the rendered HTML code from the browser and paste it here
– Ricardo
@As soon as rendered?
– Bruno Gibellino
Managed to make @Brunogibellino ?
– Sr. André Baill
The html that appears in the browser
– Ricardo
@I’ve already edited the question and added the rendered HTML
– Bruno Gibellino