SitePoint Sponsor

User Tag List

Results 1 to 1 of 1
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2005
    Murfreesboro, TN
    0 Post(s)
    0 Thread(s)

    Image reference stored in database

    I have a product database which allows up to six images per product. The URL's are stored as a reference to the images. This allows me to reference any image in one module based on the product I am on by PIC1 thru PIC6. The database reference is as follows:


    Product Name* Antique Chair
    (maximum of 255 characters)
    Product Sku* PN-05190933
    (Reference Item Number)

    pic1 =
    pic2 =
    pic3 =
    pic4 =
    pic5 =
    pic6 =

    PHP CODE, This is repeated six times for PIC1 thru PIC6 to determine if the image is present as I may only use one image or I may use all six.


    if(strlen($row['pic1']) > 0){
    $row['pic1'] = "<img src=\"$row[pic1]\" border=\"0\">\n";
    $row['pic1'] = "";


    To display image1 or PIC1 this is all I need:

    <td align="center" valign="center" width="100%">

    The same for pic1 thru pic6

    My problem is I want to use mouseover and I don't know how to reference my [pic1] thru [pic6] in an image source statement. The following does exactly what I want as far as the images are concerned but I need to be able to reference the [pic1] thru [pic6] and not the specific gif or jpg which keeps me from using just the one module.

    The code I want to replace follows. I need to know how to code the reference to [pic1] thru [pic6] and just give the second one size parameters.

    <img src="" rsrc="" border="0">

    Any help on how to code this replacing my product.gif with [pic1] would be appreciated. I know I don't need the url as the [pic1] reference already has that but I can't get the syntax right at all.

    Thanks in advance as it should be easy just to reference a "DATABASE" reference to the image like they do with <p>[pic1]</P> but I can't figure it out.
    Last edited by tnchatmonk; Aug 1, 2005 at 15:15.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts