i am trying to something real simple - add a function to a CMS to add an image and description to the databse, and output this on a webpage.
i've got a form to do this, which upload the image and description to the databse ok.
the problem is displaying this on a page. i can get get the page to display the description (but no image) and the image (but not description) - can't do both !
here's my 'display image' code:
Code: Select all
<html><head><title>Show All Images</title></head><body><p>
<?
include("dbconnect.php");
$results = mysql_query("SELECT * FROM img_table");
while ($row = mysql_fetch_array($results))
echo "<img src="get_image.php?id=" . $rowї'img_id'] . ""><br> \n";
echo "<br />" . $rowї'description'] . "</div> \n";
echo "<br />" . $rowї'project'] . "</div> \n";
?>
</p>
</body></html>here's my 'get image' code:
Code: Select all
<?
include("dbconnect.php");
$result = mysql_query("SELECT img_data FROM img_table WHERE img_id=" . $_GETї'id']);
$result_array = mysql_fetch_array($result);
header("Content-Type: image/jpeg");
echo $result_arrayї'img_data'];
?>