i have this recursive code
<ul>
<%
sql="SELECT * FROM cats ORDER BY orderid "
rs.Open sql,Conn
dim recArray
If Not rs.EOF Then
recArray = rs.getRows()
dim i
for i=0 to uBound(recArray,2)
if recArray(1,i)=0 then
call showMessage(i)
end if
next
End If
function showMessage(index)
%><li><%=recArray(2,index)%></li><%
for a=0 to uBound(recArray,2)
if recArray(1,a) = recArray(0,index) Then
%><ul><%
call showMessage(a)
%></ul><%
end if
next
%></li><%
end function
%>
</ul>
inside the loop in the function i have the for the sub(s) but after each line of li it will close the ul how can i have that dynamic and to have the output like this
<ul>
<li></li>
<li></li>
<li>
<ul>
<li></li>
<li></li>
<li></li>
</ul>
</li>
<li></li>
</ul>
and not like this
<ul>
<li></li>
<li></li>
<li>
<ul><li></li></ul>
<ul><li></li></ul>
<ul><li></li></ul>
</li>
<li></li>
</ul>