hi guys, im tryin to create a left side navigation menu that will run from a database. this will have main categories and sub categories.
i've managed to get the first category to show but i need the process to repeat in order to see the other categories and their sub categories.
im a beginner so excuse my coding can anyone help???
this is what i've got so far
---------------------------------------
<!--#include file="Connections/pro3.asp" -->
<%
Dim catRS__MMColParam
catRS__MMColParam = "1"
If (Request("MM_EmptyValue") <> "") Then
catRS__MMColParam = Request("MM_EmptyValue")
End If
%>
<%
Dim catRS
Dim catRS_numRows
Set catRS = Server.CreateObject("ADODB.Recordset")
catRS.ActiveConnection = MM_pro3_STRING
catRS.Source = "SELECT DISTINCT category FROM product WHERE onlinestatus = '" + Replace(catRS__MMColParam, "'", "''") + "' ORDER BY category ASC"
catRS.CursorType = 0
catRS.CursorLocation = 2
catRS.LockType = 1
catRS.Open()
catRS_numRows = 0
%>
<%
Dim subcatRS__MMColParam
subcatRS__MMColParam = "1"
If (Request("MM_EmptyValue") <> "") Then
subcatRS__MMColParam = Request("MM_EmptyValue")
End If
%>
<%
Dim subcatRS
Dim subcatRS_numRows
Set subcatRS = Server.CreateObject("ADODB.Recordset")
subcatRS.ActiveConnection = MM_pro3_STRING
subcatRS.Source = "SELECT category, subcategory FROM categories WHERE visible = " + Replace(subcatRS__MMColParam, "'", "''") + " ORDER BY location ASC"
subcatRS.CursorType = 0
subcatRS.CursorLocation = 2
subcatRS.LockType = 1
subcatRS.Open()
subcatRS_numRows = 0
%>
<% If Category = "home" THEN %>
<font color="red"><b>Home</b></font><br><br>
<% ELSE %>
<a href="default.asp?Category=home">Home</a><br><br>
<% END IF %>
<% Response.Write((catRS.Fields.Item("category").Value)&"<br>")
WHILE (subcatRS.Fields.Item("category").Value) = (catRS.Fields.Item("category").Value)
Response.Write((subcatRS.Fields.Item("subcategory").Value)&"<br>")
subcatRS.MoveNext
WEND
%>
<% catRS.MoveNext %>
p.s. i will do the hyperlinks later when i've got round this problem
<message edited by hadib on Thursday, March 01, 2007 3:51 AM>