I have tried many way and googled a lot but still i can not make this work.
The output i am getting is the alt attribute in my database.
my picture has these attributes in the database: piccontent picname pictype picsize
my data type is blob and the id i am working with is 47 as this is the id the picture is in on my images table on my database.
in the main html file i called a php file like this:
<img alt="Your Picture Here" height="106" src="get_image.php" width="126">
in get_image.php i wrote the following:
Code: Select all
<?php
require_once("connection.php");
$query = "SELECT picname, pictype, picsize, piccontent FROM images WHERE id = '47'";
$result = mysql_query($query) or die('Error, query failed');
$data = @MYSQL_RESULT($result,0,"piccontent");
$type = @MYSQL_RESULT($result,0,"pictype");
$size = @MYSQL_RESULT($result,0,"picsize");
header('Content-type: ' . $type);
echo $data
?>