0

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']) . '">';?>
2
Contributors
2
Replies
17
Views
3 Years
Discussion Span
Last Post by sultankhan
0

@minitauros thanks! but its not work for me as i have use both case and i have clearly show it in my thread.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.