i have a table
tbl_image
--------------
imgID(int)
imgName(varchar)
image(blob)
here is code to display image :
<?php
$query = "SELECT * FROM tbl_image ORDER BY imgID DESC";
$result = mysqli_query($conn, $query);
while ($row = mysqli_fetch_array($result)){
$imgName = $row['imgName'];
echo '<div class="col-sm-3 gallery-grids-left">
<div class="gallery-grid">
<a class="example-image-link" href="data:image/jpeg;base64,'.base64_encode($row['image'] ).'"
data-lightbox="example-set"
data-title='.$imgName.'>
<img src="data:image/jpeg;base64,'.base64_encode($row['image'] ).'"/></a></div></div>';
}
?>
but I'm really not like to use echo '';
so I changed to
<?php
$query = "SELECT * FROM tbl_image ORDER BY imgID DESC";
$result = mysqli_query($conn, $query);
while ($row = mysqli_fetch_array($result)){
$imgName = $row['imgName'];
?>
<div class="col-sm-3 gallery-grids-left">
<div class="gallery-grid">
<a class="example-image-link" data-lightbox="example-set"
href="<?php echo '<img src="data:image/jpeg;base64,'.base64_encode($row['image'] ).'"; '?>"
data-title="<?php echo imgName;?>">
<?php echo '<img src="data:image/jpeg;base64,'.base64_encode($row['image'] ).'"; '?>
</a>
</div>
</div>
<?php }
?>
It just display only image , no title no "image block" like this image demo
Plz help me to show my mistake?and how to fix it. Many thanks,