A Binary Large Object ( BLOB ) is a MySQL data type that can store binary data such as images, multimedia, and PDF files.
when i run the code below it displays an image that is stored in a mysql Db as a blob variable. The problem is if I echo out anything else, even something as simple as echo '--------'; before I call the image, the image will not display. only random characters display. if i echo out anything after the image the image displays but nothing does after it. Can someone tell me why this is and how i can go about displaying other items and the image together, thanks
<?php
include("inc/library.php");
connectToDatabase();
$sql = "SELECT * FROM theBlogs WHERE ID = 1;";
$result = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_array($result);
header("Content-type: image/jpeg");
echo $row['imageContent'];
$db->close();
?>
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