I'm trying to display some categories and sub-categories in a dropdown box, the table looks like this:
CatID (counter, ID)
CatName (name)
CatBel (if it's a sub: ID of the category it belongs to, if it's a main category: "none")
to get all the main categories I write:
<%
SQL="Select * From Categ Where CatBel='none'"
Set ca=Conn.Execute(SQL)
Do Until ca.EOF
%>
<option value="<%=ca("CatID")%>"><%=ca("CatName")%></option>
<%
ca.MoveNext
Loop
ca.Close
Set ca=Nothing
%>
but the problem starts when I want to display all the subs I could write:
<%
SQL="Select * From Categ Where CatBel='none'"
Set ca=Conn.Execute(SQL)
Do Until ca.EOF
%>
<option value="<%=ca("CatID")%>"><%=ca("CatName")%></option>
<%
SQL2="Select * From Categ Where CatBel='"& ca("Catbel") &"'"
Set tac=Conn.Execute(SQL2)
Do Until tac.EOF
%>
<option value="<%=tac("CatID")%>"><%=ca("CatName")%>/<%=tac("CatName")%></option>
<%
tac.MoveNext
Loop
tac.Close
Set tac=Nothing
Next
ca.MoveNext
Loop
ca.Close
Set ca=Nothing
%>
But then I just get one level deep :(
How do I display all the subs?
Please I really need help with this!
Thanx
-=Data-Doktorn=-
Snart på en dator nära dig!
Edited by - anderzzo on 19 June 2001 04:56:18