Hi,
I'm making a music database, and I need to list 20 tracks. Currently, Im typing the following code 20 times:

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

replacing 01 and Track1 with 02, 03, 04 Track2 Track3, Track4 etc.

Now, I tried using the for loop like this:

<%
for i= 1 to 20
%>
<a href="music/<%=rs1("artist") %>/<%=rs1("album") %>/<%=i%>%20<%=rs1("Track1") %>.<%=rs1("ext") %>"><%=rs1("Track1") %></a><br>

<%
next
%>

But when I change the <%=rs1("Track1") %> to <%=rs1("Track"&<%=i%>) %>

it doesn't work . What am I doing wrong here? Do let me know. Thanks

Recommended Answers

All 2 Replies

Try

<% trackname = "track"&i %>
<%=rs1(trackname)%>

Hey Thanks, dude. It worked

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.