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.
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")
[CODE = red]<img src="images/" & <%=cimage%> & " align=""left"">[/CODE]<P>
here you go!
<img src="images/<%=cimage%>" border="0" align="left" width="79" height="79"><P>
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.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)