Reputation: 65
image is not displaying from the database it show just showing broken image
<?php
$con = mysql_connect('localhost', 'root', ''); //Update hostname
mysql_select_db("postad", $con); //Update database name
$query = "SELECT path1 FROM img_tbl";
$result = mysql_query($query) or die('Error : ' . mysql_error());
$row = mysql_fetch_array($result);
$photo = $row['path1'];
echo "<center><img src=$photo alt=Profile Photo>";
?>
Upvotes: 1
Views: 3186
Reputation: 21
Change second last line with this
echo '<center><img src="'.$photo.'" alt="Profile Photo"></center>';
This will work if $photo path is correct...
Upvotes: 1
Reputation: 16772
Moving from the comments, this is the fix you need:
echo '<center><img src= '.$photo.' alt="Profile Photo"></center>';
Upvotes: 2
Reputation: 1030
$photo is path right
then try this
echo '<center><img src='.$photo.'alt="Profile Photo"></center>';
Upvotes: 4