Reputation: 577
I'm not getting any image that i stored in my database . the path of image is stored in database . But whenI try to get image it show me a blank page.\
Notice: I want to show images as well as text . So please don't write header.`
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "db_dat";
$s='';
$conn = mysqli_connect($servername, $username, $password, $dbname);
$uploadDir = 'C:\wamp\www\images\passport images';
$sql = "SELECT * from upload2 ";
$result = $conn->query($sql);
while($row = $result->fetch_assoc()) {
echo '<img src= "'.$uploadDir.'" ."'.$row['name'].'">' ;
}
?>
`
Upvotes: 0
Views: 25
Reputation:
try this
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "db_dat";
$s='';
$conn = mysqli_connect($servername, $username, $password, $dbname);
$uploadDir = 'http://localhost/images/passport images';
$sql = "SELECT * from upload2 ";
$result = $conn->query($sql);
while($row = $result->fetch_assoc()) {
echo '<img src= "'.$uploadDir.'" /"'.$row['name'].'">' ;
}
?>
Upvotes: 1