How to fetch image from database in php


Earlier than beginning with the dialogue relating to the fetching of pictures.

First, create a desk title referred to a picture within the database.

Beneath is the SQL question execute in PHPMyAdmin so a desk is created

<!DOCTYPE html>



<title>Image retrieve</title>




<form name=”form1″ action=”” method=”post” enctype=”multipart/form-data”>



<td><input type=”submit” name=”submit2″ value=”display”></td>





$con = mysqli_connect(‘′,’root’,”,’admin’) or die(‘Unable To connect’);




   $res=mysqli_query($con,”select * from images”);

   echo “<table>”;

   echo “<tr>”;




   echo “<td>”;

   echo ‘<img src=”data:image/jpeg;base64,’.base64_encode($row[‘image’] ).'” height=”200″ width=”200″/>’;

   echo “<br>”;

   ?><a href=”delete.php?id=<?php echo $row[“id”]; ?>”>Delete</a> <?php

   echo “</td>”;


   echo “</tr>”;


   echo “</table>”;





After executing the above SQL question desk is created as proven under.

Add a Comment

Your email address will not be published. Required fields are marked *