I am trying to get all certificates from database to show on slider, My slide show only one image while it gets the count of images correct, this is the code I was trying to show images with.
using PHP and Bootstrap for carousel viewer.
<div class="row border rounded-lg" style="text-align: center; margin-right: 150px; margin-left: 180px;">
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<?php
$certificates = new Certificates();
$a=0;
if($certificates->getEmpCeretificate($_GET['id'])) {
foreach($certificates->getEmpCeretificate($_GET['id']) as $certificate) {
if($a==0){
echo '<li data-target="#carouselExampleIndicators" data-slide-to="'.$a.'" class="active"></li>';
}
else{
echo '<li data-target="#carouselExampleIndicators" data-slide-to="'.$a.'"></li>';
}
$a = $a + 1 ;
}
}
?>
</ol>
<div class="carousel-inner">
<?php
$b=0;
if($certificates->getEmpCeretificate($_GET['id'])) {
foreach($certificates->getEmpCeretificate($_GET['id']) as $certificate) {
$image = base64_encode($certificate['certificate_image']);
echo '<p> '. $certificate['cnt'] . '</p>' ;
if($b==0){
echo '<div class="carousel-item active" >';
}
else{
echo '<div class="carousel-item" >';
}
echo '<img class="d-block w-100" src="data:image/jpg;charset=utf8;base64,'. $image .'" style="width: 100%; height:300px;" />';
echo ' <div class="carousel-caption">';
echo ' <h3>'. $certificate['name'] .'</h3>';
echo ' </div>';
echo '</div>';
$b = $b + 1 ;
}
}