My Database has a table (a) where i have a id as PK and a table for images (output_images), which contents id from (a) as foreign key.
output_images table:
image_id tinyint(3) NOT NULL AUTO_INCREMENT,
image_type varchar(25) NOT NULL,
imageData mediumblob BINARY
a_ID int(11)
image.php to get every image out of database:
<?php
mysql_connect("... .com","user","pw");
mysql_select_db("database");
if(isset($_GET['image_id'])) {
$sql = "SELECT imageType,imageData FROM output_images, a WHERE
output_images.a_ID=a.a_ID" . $_GET['image_id'];
$result = mysql_query("$sql") or die("<b>Error:</b> Problem on Retrieving Image BLOB<br/>" . mysql_error());
$row = mysql_fetch_array($result);
header("Content-type: " . $row["imageType"]);
echo $row["imageData"];
}
mysql_close();
?>
listimages.php calls image.php to build a list of images:
<?php
mysql_connect("... .com","user","pw");
mysql_select_db("database");
$sql = "SELECT imageId FROM output_images,a Where output_images.a_ID=a.a_ID ORDER BY imageId DESC";
$result = mysql_query($sql);
?>
<HTML>
<HEAD>
<TITLE>List BLOB Images</TITLE>
<link href="imageStyles.css" rel="stylesheet" type="text/css" />
</HEAD>
<BODY>
<?php
while($row = mysql_fetch_array($result) or die (mysql_error())
{
?>
<img src="image.php?image_id=<?php echo $row["imageId"]; ?>" /><br/>
<?php
}
mysql_close();
?>
</BODY>
</HTML>
actual error message:
Parse error: syntax error, unexpected '{' in home/a9996478/public_html/listImages.php on line 15
if i change the fifth line of listImages.php to:
$sql = "SELECT imageId FROM output_images ORDER BY imageId DESC";
i get the same problems, even i also get before for this line 12 broken pics
i don´t know whats the problem....