RE: [PHP-DB] Retrieving/Displaying hyperlinked images with PHP
| From: | César Aracena | Date: | Sun, 07 Jul 2002 03:49:27 +0000 |
| Subject: | RE: [PHP-DB] Retrieving/Displaying hyperlinked images with PHP | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-20361@lists.php.net to get a copy of this message | ||
Sorry. The code down there should read:
[snip]
// Then show image and/or details
echo "<img src=/image_folder/".$row[product_image].">";
[snip]
> -----Original Message-----
> From: César Aracena [mailto:icaam@icaam.com.ar]
> Sent: Sunday, July 07, 2002 12:46 AM
> To: 'markbm'; php-db@lists.php.net
> Subject: RE: [PHP-DB] Retrieving/Displaying hyperlinked images with
PHP
>
> Maybe I don't understand what your need is, but here's a shot.
>
> What you want to do, I've accomplished before just by placing a field
in
> the database which points to the image name called i.e. product_image.
> What this field contains, is just the name of the picture i.e.
> prod_001.jpg. When the *details.php* page is displayed, I just make
PHP
> print the image like this:
>
> // First, make array of product from DB
> $row = mysql_fetch_array($query);
>
> // Then show image and/or details
> echo "<img src=/image_folder/.$row[product_image].>";
>
> and that's it.
>
> Like this, you just have to specify the name of each image when
> inserting a new product. You can also make more than one image field
if
> needed i.e. several angles of a vehicle.
>
> Hope this helps you,
>
> C.
>
> > -----Original Message-----
> > From: markbm [mailto:markbm@hotmail.com]
> > Sent: Saturday, July 06, 2002 8:35 PM
> > To: php-db@lists.php.net
> > Subject: [PHP-DB] Retrieving/Displaying hyperlinked images with PHP
> >
> > 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?
> >
> > 2. The code sample below contains several lines that show a field
> > populated
> > with text that I am returning....the line under the //Test comment
is
> the
> > field that I'm trying to pull an image back for:
> >
> > 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"));
> >
> > //test
> > printf(mysql_result($result,0,<a href="FRONT_REND">FRONT_REND</a>);
> >
> > NOTE: "FRONT_REND" is the name of the database field, and it
contains
> a
> > full
> > web address, not relative.
> >
> > Any help would be GREATLY appreciated. Thanks.
> >
> > Mark
> >
> >
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php