I have read both the columns on PhpBuilder dealing with images and mysql database's and am still having a problem that is taking me hours to solve.
What I want to accomplish is to display an image that is id'ed in my mysql db like this:
<img src="viewimage.php3?id=2">
The database is already built and filled with several images but there must be something wrong with my viewimage.php3 script because the image is broken. Without the header line, the script outputs >> pics/whateverthepicturenameis.jpg --and logically I figured this would work since that's the exact text needed in the <img src> tag.
Here is viewimage.php3:
// the pictures are stored in the /pics/ directory on my server.
<?php
if($id) {
@MYSQL_CONNECT( "localhost", "root", "comeagain");
@mysql_select_db( "IMAGES");
$query = "select picture_name from images where id=$id";
$result = @MYSQL_QUERY($query);
$data = @MYSQL_RESULT($result,0, "picture_name");
Header( "Content-type: image/jpeg");
echo ("pics/$data");
};
?>
Perhaps someone can help me solve this problem. TIA.