I am trying to display a jpg image from database 'cemembers' under table 'users' column 'image'. With this logic I Created custom code but when I run my page in php only echo the file name stored in database but with no graphical view. example 'cdda_dd.jpg' I later inspect the image from the browser and i can see the problem might be coding a wrong image src... please look at my codes and help me out.
<?php
//setting connection variables
$hostname = "localhost";
$username= "root";
$password ="";
$db= "cemembers";
//connect to database
$mysqli_db = new mysqli( $hostname, $username, $password, $db);
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$sql = mysqli_query($mysqli_db, "SELECT * FROM users WHERE image ");
$row= mysqli_fetch_array($sql);
$photo= $row['image'];
echo $photo;
?>