<%
sub discussionmanage()
'on error resume next
response.write("<span class=""textsubhead"">Discussion setting</span><br />" & vbcrlf)
sql = "select * from " & dbprefix & "forums where parent_id IS NULL"
rs.open sql,con,1,3
do while not rs.eof
response.write(rs("forum_name") & "<br />")
call listcategoryadmin(rs("forum_id"))
rs.movenext
loop
rs.close
end sub
sub listcategoryadmin(parentid)
'if parentid <> "" then
'rs2.close
'end if
sql2 = "select * from " & dbprefix & "forums where "
if parentid = "" then
sql2 = sql2 & "parent_id IS NULL"
elseif parentid <> "" then
sql2 = sql2 & "parent_id = " & parentid & ""
else
sql2 = sql2 & "parent_id = " & parentid & ""
end if
sql2 = sql2 & " group by parent_id"
set rs2 = con.execute(sql2)
do while not rs2.eof
FID = rs2("forum_id")
response.write(rs2("forum_name") & "<br />")
call listcategoryadmin(FID)
if not rs2.eof then
rs2.movenext
end if
loop
'rs2.close
end sub
%>
ผลที่ออกมามันไม่ได้อย่างที่ต้องการด้านบน มันได้แบบนี้..
main forum1
main1 sub1
main1 sub2.1
main1 sub3
main forum2
main2 sub1