www.webdeveloper.com
Results 1 to 3 of 3

Thread: linking an image

  1. #1
    Join Date
    Feb 2003
    Posts
    194

    linking an image

    As part of our cleanup effort, I am modifying our shopping cart program but have run into a little snag.

    We store an image in our access db and reference it on our html file.

    This is the current working one line syntax:

    strHTML = strHTML & "<img src=" & q& "images/small/" & rs("cimageurl") &q& " align=" & q& "left"& q & ">" & vbcrlf

    Of course is used for adding single quotes
    q = chr(34)

    Now I am creating a search page that will allow users to search by either product name or category name.
    obviously it would make sense like the user requested to have the picture of the item show on the same page is the item description and price.

    So far, I have been trying to duplicate the about reference to image but with no luck.

    The image asks as though the path reference is wrong.
    I see the shape of the image but not the image itself.
    Please help.
    Below is the code I have been playing with.

    The code in red is the culprit.

    sql="SELECT cname, cDescription, cPrice,cimageurl " &_
    "FROM Products " &_
    "WHERE catalogID=" & Product_Id
    Set RS = DataConnection.Execute(sql)

    Title = RS("cname")
    Description = RS("cDescription")
    cimage = RS("cImageurl")
    Price = RS("cPrice")

    <BODY>
    <H1><%=Title%></H1>
    <%=Description%><P>
    [CODE = red]<img src="images/" & <%=cimage%> & " align=""left"">[/CODE]<P>
    <%=Price%>
    </BODY>

  2. #2
    Join Date
    Dec 2002
    Posts
    316
    hi,
    here you go!

    <img src="images/<%=cimage%>" border="0" align="left" width="79" height="79"><P>

  3. #3
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    5,298
    For sake of elaboration, HTML does not use the ampersand ( & ) character for concatenation. So you only have to chuck the <%= and %> elements into your double quotes.

    You will only need the ampersand when working within the ASP code. ie in between <% and %>. Otherwise, your just using plain HTML.

    Regards,
    Andrew Buntine.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles