In: Computer Science
i used this coding for select image from database but the image did not retrieve from database and did not display
what is the issue ?
include "connect.php";
$sql= "select fileTmpPath
from picture where ID='3'";
$result =
mysqli_query($conn,$sql);
$pic=
mysqli_fetch_array($result);
echo " <img src=" .$pic["fileTmpPath"]."' />";
?>
Dear Student ,
As per requirement submitted above kindly find below solution.
Here new web page with name "picture.php" is created which contains below code.
NOTE :IMAGES AND FILE PICTURE.PHP IS PLACED IN THE SAME LOCATION IN THE SERVER.
Table :

*****************************
picture.php :
<?php
include "connect.php";//INCLUDE FILE TO CONNECT TO DATABASE
$sql= "select fileTmpPath from picture where ID='3'";//sql query
$result = mysqli_query($conn,$sql);//execute query
$pic= mysqli_fetch_array($result);//fetch the result
//show image
echo " <img src=" .$pic["fileTmpPath"]." />";
?>
==================================
Output :Open web page picture.php in the browser and will get the screen as shown below.
Screen 1:

NOTE :PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.