0
$con= mysqli_connect("host", "user", "password", "database");  
session_start();
if(isset($_SESSION['username'])){
    //echo 'Hi! '.$_SESSION['username'];
}
if(isset($_GET["name"])){
    $n= "SELECT * FROM `users` WHERE `user_name`='".$_GET['name']."' "[0];
    $r= mysqli_query($con, $n);
    if($r){
        while($row= mysqli_fetch_assoc($r)){
             echo $row['Full_name'];
             $image= $row['profile'];
             echo $image;
    }
    }
}

Here is my Code. When I run it it just shows scrambled lines(!!) What can I do to display the images which are saved as Longblob in mysql database.

This is a web-based project, coded in cpanel hosting. I tried some solutions but they didn't work. I think the problem happens in the links

I tried this solution:

<img src="data:image/jpeg;base64,<?php echo base64_encode( $image ); ?>" />
Your Common Sense
  • 156,878
  • 40
  • 214
  • 345

1 Answers1

0

Don't use blob to store images. Use varchar to save URL of the image and upload that images to specific folder. MySQL is not designed to store images.

Ashok
  • 131
  • 2
  • 7