I have a couple of sites sharing a database. There will be a small number of images. Currently each site has a seperate image upload process where the image is stored on the server and the path is stored in a MS SQL table. I have been trying to use the image data and not the path so I can read the data from the database and use it on each site.
Here is some of the code I'm trying:
This works, except only the first image in the table is displayed. If I use a non-image field the result set contains all the matching data.
to display the image with markup I use this on a seperate page. I haven't tried posting back to the same page, but i suspect that would also work, except of course, it would still display only one image.
Can you display more than one image to a browser when using the actual image data and not just a path to the image?
tia...mike
Here is some of the code I'm trying:
Code:
if(!$link)
{
die('Something went wrong while connecting to the database.');
} else {
$sql = "SET TEXTSIZE 2147483647";
@mssql_query($sql);
$sql = "select name,filetype,photodata
from photos";
$results = @mssql_query($sql, $link);
if (!$results) {
exit("<strong>Error while loading photo</strong>");
}
while ($row = mssql_fetch_assoc($results)) {
header("Content-header: image/".$row['filetype']);
$imageID = $row['photodata'];
print $imageID;
}
mssql_free_result($results);
}
This works, except only the first image in the table is displayed. If I use a non-image field the result set contains all the matching data.
to display the image with markup I use this on a seperate page. I haven't tried posting back to the same page, but i suspect that would also work, except of course, it would still display only one image.
Code:
<table border="5" width="900">
<tr>
<td><img src="imageprocessing.php?imageID=<?php print $imageID;?>" /></td>
</tr>
</table>
Can you display more than one image to a browser when using the actual image data and not just a path to the image?
tia...mike