Hi,
In a project I'm working on, Im supposed to display 20 track names (its a music database). Currently, Im adding the links to the tracks like so:

<a href="music/<%=rs1("artist") %>/<%=rs1("album") %>/<%=rs1("tno1") %>%20<%=rs1("Track1") %>.<%=rs1("ext") %>"><%=rs1("Track1") %></a><br>

This same line is repeated 20 times, with the number1 being replaced by 2, 3, 4, 5......till 20. Is there a loop which I can use such that the line above displays 20 times without having to type these 20 lines ?
Thanks

Recommended Answers

All 2 Replies

I would use a 2d array then do

for varCounter = 1 to 20
blahblahblah rs(varcounter)("artist") blahblahblah rs(varcounter)("album")

You may use the below:

<%
url = "music/" & rs1("artist") "/" & rs1("album") & "/" & rs1("tno1") & "/" & rs1("Track1")
%>

If the url varaibles may change, then you can integratecampkev code to the above.

And you links will become:
<a href="<%=url%>">Track Name</a>

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.