Soldato
- Joined
- 10 Apr 2006
- Posts
- 7,890
- Location
- North West
Second post in a few days, keep getting stuck on things 
Quick run over of tables im using for this:
Package, Picture, package_picture.
Package contains all the data and Package_ID.
Picture contains the BLOB and Picture_ID.
Package_Picture contains Picture_ID & Package_ID.
Package_ID links the 3 tables together.
I have package.php which queries the db and pulls out the relevant data, but I need it to pull out the image in "Picture".
In package.php I have:
Gets the ID of the package currently being viewed and posts the image_test.php for the image.
In image_test.php I have:
Its probably something daft that I have missed out, but its really irritating me and I cant find what it is!
Thanks anyone

Quick run over of tables im using for this:
Package, Picture, package_picture.
Package contains all the data and Package_ID.
Picture contains the BLOB and Picture_ID.
Package_Picture contains Picture_ID & Package_ID.
Package_ID links the 3 tables together.
I have package.php which queries the db and pulls out the relevant data, but I need it to pull out the image in "Picture".
In package.php I have:
PHP:
$imageID = $_GET['id'];
<img src="image_test.php?id=<?php print $imageID; ?>" >
In image_test.php I have:
PHP:
<?php
header("Content-Type: image/jpg");
require("functions.php"); //Gets all the functions
dbConnect(); //Connects to the database
$imageid = $_GET['id'];
if ($imageid) {
$sql = "SELECT image, description, package_ID FROM picture, package, package_picture WHERE package_ID = {$_GET['id']}";
$result = mysql_query($sql);
$data = mysql_result($result, 0, "bin_data");
$type = mysql_result($result, 0, "filetype");
$bytes = $row['image'];
print $bytes;
}
?>
Its probably something daft that I have missed out, but its really irritating me and I cant find what it is!
Thanks anyone
