Question: I have a database containing movies Name, their description and their cover picture. The cover picture field type is as blob and the problem is that I can't retrieve it from the database. I want to display the movie name along their cover picture beside them... How to do it.. Here is my code..

```
<?php

include ("php/connection.php");
$ID = $_GET['id'];
$listmovies = "SELECT * FROM movies where Genres LIKE '%$ID%'";
$result = mysql_query($listmovies);
while ( $row = mysql_fetch_assoc($result) ) {
    ?>
<table border="1" width="100%">
    <tr>
        <td rowspan="2" width="90" height="120">
<?php

    // set the header for the image
    header("Content-type: image/jpeg");
    echo $row['Image'];

    ?> </td>
        <td width="200" height="10">
<?php

    echo $row['Title'];
    ?></td>
    </tr>
    <tr>
        <td width="200" height="110"><a
            href="php/moredetails.php?id=<?php echo $row['ID']; ?>">More Detail</a></td>
    </tr>
<?php } ?> </table>

```

I just want to display The Imgaes beside the title of the movie?

Answer: 
Yes it won't display because `any output above header would always generate error` ... you need to have a different page to output your image or include it has `base64` image

Remove

```
header("Content-type: image/jpeg");
echo $row['Image'];

```

And add this : 

```
printf("<img src=\"data:image/jpeg;base64,%s\" />",base64_encode($row['Image']));  
                               ^--- Note this is only for jpeg images

```
I suggest something like that:

Make a new php file called for example image.php; That file will replace physical image file.
In that file you put the code from your post plus some logic to get image data from database;

In parent template(php file maybe) you put code for image:

```
<img src="image.php?id_movie=<?php echo $id_movie; ?>" width ="200" height="200" /> More Detail

```

In image.php i suggest to be careful at spaces outside php tags (at the beniging and at the end).
Also to image.php you need to give id of the movie to know what image to load from database.