Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 1st, 2004, 11:20 AM
Registered User
 
Join Date: Oct 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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

 
Old October 5th, 2004, 03:52 AM
Authorized User
 
Join Date: Jul 2004
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Have you checked if you are using absolute or relative folder locations?

Michael.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying images stored in MySQL through in PHP trufla PHP Databases 3 May 2nd, 2006 04:55 AM
HELP - Displaying Images from mysql timmaher Beginning PHP 5 January 26th, 2005 03:09 PM
Displaying values in dropdown list from mysql db scoobie Beginning PHP 3 January 25th, 2005 12:09 PM
Displaying images stored in a DB on a Web Form Trevor Miles ASP.NET 1.0 and 1.1 Basics 0 January 7th, 2005 04:14 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.