displaying images from mySql DB in html
Hello,
I'm using dreamweaver mx2004 to develop a website and have been trying to insert an image from a mysql DB and can't get it to work.
Here is the code:
<?php $var1=($row_Recordset1["PROD_ID"]); ?> <?php echo $var1; //for testing ?>
<?php $PROD_ID = $var1; ?>
<td width="150" height="150" align="center" valign="top"><?php echo ("<img src=getImage.php?PROD_ID=$var1>"); ?></td
Then I have a separate php file called getImage.php
<?php //getImage.php
include("Connections/testingDB.php");
$PROD_ID = $_GET('PROD_ID');
//echo $PROD_ID;
if($PROD_ID){
$connID = mysql_select_db($database_testingDB, $testingDB);
$result = @mysql_query(
"SELECT IMAGE_THUMB FROM PRODUCT WHERE PROD_ID = $PROD_ID");
if(!$result) exit;
$row = @mysql_result($result, 0, "IMAGE_THUMB");
if(!$row) exit;
header("Content Type: jpeg");
echo $row;
};
?>
When it runs I get the webpage fine, but no images, just image place holders.
Any ideas would be greatly appreicated.
Thank you,
Chris
|