Muhammad Usman Muhammad Usman - 1 year ago 72
SQL Question

image display from database in php

i want to display image from database and below is my code where empid is the value of textbox, it's showing the image name stored in database but i am not able to echo this picture. anyone can help in this regard.


$result = $db->prepare("SELECT image FROM info WHERE empid= $empid");
$result->bindParam('$empid', $empid);
for($i=0; $rows = $result->fetch(); $i++){

echo $rows['image'];



Answer Source

Change this line.

$result = $db->prepare("SELECT image FROM info WHERE empid= '". $empid ."'");