> -----Original Message----- > From: Miguel Cruz [mailto:[EMAIL PROTECTED]] > Sent: Monday, July 08, 2002 12:56 AM > To: markbm > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP] Retrieving/Displaying hyperlinked images with PHP > > Instead of: > > echo "<img src=http://www.website.com/images/".$result[FRONT_REND].">"; > > Wouldn't you want it to be: > > echo "<img src='http://www.website.com/images/" . mysql_result($result, > 0, 'FRONT_REND') . "'>'; > > ...? > > miguel
[César L. Aracena] What Miguel says here is completely true... you do need to call the resulting query the right way. I guess you tried to follow an example I or someone else gave you before in order to work with an array made from the resulting query. You should read some useful lessons and tricks about using arrays at www.php.net in order to be able to recognize them first and then work with them... quite handy feature I should add. C. > > On Sun, 7 Jul 2002, markbm wrote: > > Thanks for the reply. The question is how to pull that hyperlink/file > > location and display the image file on a PHP page. Basically, the text > in > > the FRONT_REND field is just an image name (1855.jpg), and I store the > > prefix to that location on the page. I have included all the code from > my > > page below....the issue at hand is noted by //Problem Area//. Note also, > > that all fields above this item are simply just retrieving text from a > db > > field not retrieving a file from the db/web server location. Again, > thanks > > for your help. > > > > CODE: > > =============================================== > > > > <body> > > > > > > > > <?php > > > > > > > > $db = mysql_connect("localhost", "username", "password"); > > > > > > > > mysql_select_db("dbname",$db); > > > > > > > > $result = mysql_query("SELECT * FROM PRODUCTS",$db); > > > > > > printf("ID: %s<br>\n", mysql_result($result,0,"ID")); > > printf("HPG_PLAN_ID: %s<br>\n", mysql_result($result,0,"HPG_PLAN_ID")); > > printf("DESIGNER: %s<br>\n", mysql_result($result,0,"DESIGNER")); > > printf("PLAN_NAME: %s<br>\n", mysql_result($result,0,"PLAN_NAME")); > > printf("EXTERIOR: %s<br>\n", mysql_result($result,0,"EXTERIOR")); > > printf("NUM_BEDROOMS: %s<br>\n", > mysql_result($result,0,"NUM_BEDROOMS")); > > printf("NUM_BATHS: %s<br>\n", mysql_result($result,0,"NUM_BATHS")); > > printf("NUM_FLOORS: %s<br>\n", mysql_result($result,0,"NUM_FLOORS")); > > printf("GARAGE: %s<br>\n", mysql_result($result,0,"GARAGE")); > > printf("NUM_CARS: %s<br>\n", mysql_result($result,0,"NUM_CARS")); > > printf("FOUNDATION: %s<br>\n", mysql_result($result,0,"FOUNDATION")); > > printf("MAT_LIST: %s<br>\n", mysql_result($result,0,"MAT_LIST")); > > printf("COLOR_REND: %s<br>\n", mysql_result($result,0,"COLOR_REND")); > > printf("PICTURES: %s<br>\n", mysql_result($result,0,"PICTURES")); > > printf("REPRODUCIBLE: %s<br>\n", > mysql_result($result,0,"REPRODUCIBLE")); > > printf("RR_REVERSE: %s<br>\n", mysql_result($result,0,"RR_REVERSE")); > > printf("MIRROR_REV: %s<br>\n", mysql_result($result,0,"MIRROR_REV")); > > printf("CAD_FILES: %s<br>\n", mysql_result($result,0,"CAD_FILES")); > > printf("BONUS_ROOM: %s<br>\n", mysql_result($result,0,"BONUS_ROOM")); > > printf("WIDTH: %s<br>\n", mysql_result($result,0,"WIDTH")); > > printf("DEPTH: %s<br>\n", mysql_result($result,0,"DEPTH")); > > printf("HEAT_SQ_FT: %s<br>\n", mysql_result($result,0,"HEAT_SQ_FT")); > > printf("UNHEAT_SQ_FT: %s<br>\n", > mysql_result($result,0,"UNHEAT_SQ_FT")); > > printf("TOTAL_SQ_FT: %s<br>\n", mysql_result($result,0,"TOTAL_SQ_FT")); > > printf("ROOF_TYPE: %s<br>\n", mysql_result($result,0,"ROOF_TYPE")); > > printf("ROOF_PITCH: %s<br>\n", mysql_result($result,0,"ROOF_PITCH")); > > printf("SEC_ROOF_PITCH: %s<br>\n", > > mysql_result($result,0,"SEC_ROOF_PITCH")); > > printf("MAIN_CEIL_HEIGHT: %s<br>\n", > > mysql_result($result,0,"MAIN_CEIL_HEIGHT")); > > printf("PLAN_DESCRIPTION: %s<br>\n", > > mysql_result($result,0,"PLAN_DESCRIPTION")); > > printf("REL_PLAN1: %s<br>\n", mysql_result($result,0,"REL_PLAN1")); > > printf("REL_PLAN2: %s<br>\n", mysql_result($result,0,"REL_PLAN2")); > > printf("REL_PLAN3: %s<br>\n", mysql_result($result,0,"REL_PLAN3")); > > printf("REL_PLAN4: %s<br>\n", mysql_result($result,0,"REL_PLAN4")); > > printf("REL_PLAN5: %s<br>\n", mysql_result($result,0,"REL_PLAN5")); > > printf("REL_PLAN6: %s<br>\n", mysql_result($result,0,"REL_PLAN6")); > > printf("REL_PLAN7: %s<br>\n", mysql_result($result,0,"REL_PLAN7")); > > printf("REL_PLAN8: %s<br>\n", mysql_result($result,0,"REL_PLAN8")); > > printf("REL_PLAN9: %s<br>\n", mysql_result($result,0,"REL_PLAN9")); > > > > //Problem code // > > > > // Then show image and/or details > > echo "<img src=http://www.website.com/images/".$result[FRONT_REND].">"; > > > > > > //printf("FRONT_REND: %s<br>\n", mysql_result($result,0,'<a > > href=FRONT_REND></a>')); > > printf("REAR_REND: %s<br>\n", mysql_result($result,0,"REAR_REND")); > > printf("SIDE_REND1: %s<br>\n", mysql_result($result,0,"SIDE_REND1")); > > printf("SIDE_REND2: %s<br>\n", mysql_result($result,0,"SIDE_REND2")); > > printf("THMBNAIL_IMG: %s<br>\n", > mysql_result($result,0,"THMBNAIL_IMG")); > > printf("FLRPLAN_1: %s<br>\n", mysql_result($result,0,"FLRPLAN_1")); > > printf("FLRPLAN_2: %s<br>\n", mysql_result($result,0,"FLRPLAN_2")); > > printf("FLRPLAN_3: %s<br>\n", mysql_result($result,0,"FLRPLAN_3")); > > printf("OTHER_IMG1: %s<br>\n", mysql_result($result,0,"OTHER_IMG1")); > > printf("OTHER_IMG2: %s<br>\n", mysql_result($result,0,"OTHER_IMG2")); > > printf("NUM_HITS: %s<br>\n", mysql_result($result,0,"NUM_HITS")); > > printf("PAYPAL_BUTTON: %s<br>\n", > mysql_result($result,0,"PAYPAL_BUTTON")); > > > > > > > > > > > > ?> > > > > > > > > </body> > > > > "Miguel Cruz" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > On Sat, 6 Jul 2002, markbm wrote: > > > > I am trying to build a "product detail" page that pulls data from a > > > > MYSQL database using PHP. The data for the page includes product > images, > > > > which I am trying to link to (i.e. from their location on the web > > > > server) instead of loading the images into the database. However, I > > > > cannot find any sample code that seems to work. Two questions: > > > > > > > > 1. Is this possible (i.e. to store the HYPERLINK to the image in the > > > > database , and as the results are returned to the product detail > screen, > > > > the image file will be displayed)? OR RATHER do I need to store the > > > > physical image file in the database location and query it that way? > > > > > > It's obviously much easier to store the link or the file name in the > > > database. In fact, it's so easy that I can't guess offhand what aspect > of > > > it you might be having trouble with. Perhaps you could show some more > code > > > and explain the symptoms you are observing. > > > > > > miguel > > > > > > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php