How to retrieve and display an image from MySQL using php?

Vague question is vague.

Are you storing the images as BLOB data? Are you storing a relative or absolute path to the location of the image?

Your question cannot be answered without further details.

No, i didn't store the image as blob I have a problem while loading and retrieving an image from database.I have loaded an image in the database as of type Image. but when i'm retrieving the image its not shown in webpage.

Coding which i used to retrieve the image:
<?php
mysql_connect("localhost","root","");
mysql_select_db("test");
$image_id = stripslashes($_REQUEST[image_id]);
$rs = mysql_query("select * from image where image_id=\"".
addslashes($image_id).".jpg\"");
$row = mysql_fetch_assoc($rs);
$imagebytes = $row[image_size];
header("Content-type: image/jpeg");
print $imagebytes;
?>

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.