I got a problem while displaying the images from MySQL Database. When I load the page, only the empty image element is loaded but not the actual image coming from database. I think that php code is not correct.
<?php
//connection do db
require_once __DIR__.'/connect.php';
try{
$stmt = $db->prepare('SELECT * FROM pictures');
$stmt->execute();
if($stmt->rowCount()>0)
{
while($row=$stmt->fetchColumn())
{
extract($row);
; }
}
}catch (PDOEXception $ex){
echo $ex;
}
?>
<img src="images/<?php echo $row['path']?>">
imgelement'ssrcattribute look correct? Is it justimages/or is there an actual path to an image file there? If it looks correct, then are you sure that is the correct URL to the image on your web server? Could you provide some sample output from the html page and also a full URL to an image that works when requested directly?;after the PHP line?<?php echo $row['path'];?>imgtag is outsidewhileloop (sidenode: don't post code in lines with ``` - it's not displayed)