dynamic left side navigation from database

Author Message
hadib

  • Total Posts : 1
  • Scores: 0
  • Reward points : 0
  • Joined: 3/1/2007
  • Status: offline
dynamic left side navigation from database Thursday, March 01, 2007 2:30 AM (permalink)
0
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>
 
#1

    Online Bookmarks Sharing: Share/Bookmark

    Jump to:

    Current active users

    There are 0 members and 1 guests.

    Icon Legend and Permission

    • New Messages
    • No New Messages
    • Hot Topic w/ New Messages
    • Hot Topic w/o New Messages
    • Locked w/ New Messages
    • Locked w/o New Messages
    • Read Message
    • Post New Thread
    • Reply to message
    • Post New Poll
    • Submit Vote
    • Post reward post
    • Delete my own posts
    • Delete my own threads
    • Rate post

    2000-2012 ASPPlayground.NET Forum Version 3.9