I'm trying to display the profile photo which has been uploaded at the start to the database, but its not showing it in the website. This is how it looks:
Here's the code to get the information from database:
<?php
session_start(); // start the session
include('config.php');
if(!isset($_SESSION['email'])){ // check if user is not logged in
header('Location: login.php'); // redirect to login page
exit(); // prevent further execution of the script
}
$email = $_SESSION['email']; // get the email from session
$sql = "select * from profile where email_id = '$email'"; // select user's information from the database
$result = mysqli_query($con, $sql);
$row = mysqli_fetch_array($result);
?>
Here's the code to display the image and rest of the information:
<?php
if($row['images']) {
echo '<img src="uploaded_img/'.$row['images'].'" class="image" alt="" style="border-radius: 20px;">';
} else {
echo '<img src="images/default-avatar.png" class="image" alt="" style="border-radius: 20px;">';
}
?>
<h3><?php echo $row['name']; ?></h3>
<p>Email: <?php echo $row['email_id']; ?></p>
<p>Country: <?php echo $row['country']; ?></p>
<p>Religion: <?php echo $row['religion']; ?></p>
<p>Caste: <?php echo $row['Caste']; ?></p>
<p>Zodiac: <?php echo $row['zodiac']; ?></p>
<p>Religion: <?php echo $row['religion']; ?></p>
<p>Mobile Number: <?php echo $row['mobile_number']; ?></p>
<p>Landline: <?php echo $row['Landline']; ?></p>
Image column type is blob in the database and the path of the image is correct, it shows the image name correctly
What can be the issue, can you please tell where went wrong and why, Thank you in advance
Kindly upload image in JPG or PNG fromat