Each file can only output one image. You would need to run the query separately from reading the image contents.
PHP Code:
$con = mysql_connect(suprresed);
if(!$con){
echo "Error connecting" .mysql_error();
}
$grab = mysql_select_db("foodpak");
if(!$grab){
echo "Error selecting database" .mysql_error();
}
$result = mysql_query("SELECT * FROM Listing");
while ($row=mysql_fetch_array($result))
{
echo '<img src="/fetch_image.php?name='$row[image].'" /><br/>';
}
fetch_image.php
PHP Code:
$errorImage = 'image_not_exists.gif';
$dir = 'path/to/image/directory';
$im = isset($_GET['name'])?$_GET['name']:$errorImage;
$path = file_exists($dir.'/'.$file)?$dir.'/'.$name:$dir.'/'.$errorImage;
header('Content-Type: image/gif');
// read and output image file
Bookmarks