SitePoint Sponsor

User Tag List

Results 1 to 1 of 1
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2005
    Location
    Murfreesboro, TN
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    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:

    DATABASE

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


    pic1 = http://www.mywebsite.com/store/produ...chairfront.jpg
    pic2 = http://www.mywebsite.com/store/produ.../chairback.jpg
    pic3 = http://www.mywebsite.com/store/produ...chairrside.jpg
    pic4 = http://www.mywebsite.com/store/produ...chairlside.jpg
    pic5 = http://www.mywebsite.com/store/produ...s/chairtop.jpg
    pic6 = http://www.mywebsite.com/store/produ...hairbottom.jpg

    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";
    }
    else{
    $row['pic1'] = "";
    }

    HTML CODE

    To display image1 or PIC1 this is all I need:

    <tr>
    <td align="center" valign="center" width="100%">
    <p>[pic1]</P>
    </td>
    </tr>

    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="http://website.com/store/product_imgs/product.gif" rsrc="http://website.com/store/product_imgs/product.gif" 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 14:15.


Bookmarks

Posting Permissions

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