Reputation: 3
I am facing a problem in showing images in my page using PHP. I have a table "images" in my db. I have saved the names of the images in this table which i am retrieving using PHP. My problem is that the images are not being shown due to unknown logical error. I have given both the absolute and the relative paths of the images in the tag but all in vain. Please suggest me what wrong i am doing in retrieving the code.
My PHP:-
<?php
require_once("includes/database.php");
$img_no = $_GET["img_no"];
$query = "SELECT * FROM `images` WHERE `img_no`=".$img_no;
$result = mysqli_query($con, $query);
?>
HTML:-
<div class="project owl-carousel">
<?php while($row = mysqli_fetch_array($result)){ ?>
<div class="item">
<?php echo "<img class='img-responsive' src='img/".$row['img']."png'> ";?>
</div>
<?php }; ?>
</div>
In the img src, I have given both the absolute and the relative paths of the images folder, but did not work!
Please suggest! Thanks in advance! Regards!
Upvotes: 0
Views: 41
Reputation: 479
Does your image extention(.png) is same to what you have written in your code. if yes then check whethere you have saved your image name in database with extention or without it.
Upvotes: 1