I am a beginner programmer looking to display images from mysql database.
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:
in get_image.php i wrote the following:<?php require_once("connection.php"); require_once("functions.php"); $query = "SELECT picname, pictype, picsize, piccontent FROM carpetclean 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 ?>