This is my first post, and I'm hoping this is an easy question for someone.
I have the code below. I'm trying to have both fields "Uploaded Photo" and "Additional Photo 1" show on a page with the paths corrected. With this code the only item showing is the last item "Additional Photo 1". The last filepath defined is the only one showing up. How do I get my results to show all (and there will be more - I have 8 additional photo fields that I will need to add)?
<%
filepath=rs("Uploaded Photo")
if Len(filepath)>0 then
pos=instr(filepath , "..")
if pos>0 then
do while pos>0
filepath=mid(filepath,(pos+2))
pos=instr(filepath , "..")
loop
end if
filepath="<a href='http://www.mysite.com" & filepath & "</a>"
end if
%>
<br>
<%
filepath=rs("Additional Photo 1")
if Len(filepath)>0 then
pos=instr(filepath , "..")
if pos>0 then
do while pos>0
filepath=mid(filepath,(pos+2))
pos=instr(filepath , "..")
loop
end if
filepath="<a href='http://www.mysite.com" & filepath & "</a>"
end if
The problem is that you are repeatedly setting the values to the "filepath" variable for both the paths. Assign the path of each photo to different variables .
And there could be a better way to remove the ".." in the path than what you are doing right now..
Can you show the values of paths you will be starting with ?
Thank you very much! I had tried that and it didn't work, but after looking at the code again, there was another line where it was calling in filepath - so I just had to add the additional filepath1, filepath2, etc. Now it is working. To answer your other question, the path is dynamically generated. The photo it is calling in is in the database as ../folder1/photo.jpg - so the path changes depending on where I am pulling it in from.
Bookmarks