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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With