i have store an image into my database.
but i am unable to display the image what i have done till now is under.... any help will be appreciated. thanks in advance!
<?
$query="SELECT * from testimonial";
$ret = mysqli_query($mysql,$query);
if (isset($ret) && $ret->num_rows>0)
{
while($row=mysqli_fetch_array($ret))
{
$body=$row['body'];
$name=$row['name'];
$image=$row['img'];
?>
<li>
<div class="frame-icon"><? echo "<img src=test_img.php?id=".$row['id']." width=150 height=150/>";?></div>
<p class="quote"><?php echo $body; ?><span><?php echo $name; ?></span></p>
</li>
<?php }
echo "</table>";
}
?>
and my test_img is
<?php require_once("header.php"); ?>
<?php require_once("admin/db.php"); ?>
<?php if (isset($_GET['id'])){
$id=mysql_real_escape_string($_GET['id']);
$query=mysql_query("SELECT *FROM testimonial WHERE id='$id' ");
while($row = mysql_fetch_assoc($query))
{
$image=$row["img"];
}
header("content-type: image/png");
}
else{
echo "error";
}
?>
i also try this one
<? echo '<img src="data:image/png;base64,' . base64_encode($row['img']) . '">';?>