473,379 Members | 1,222 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Menu Loop & DB

Hi,

I'm trying to create an expandable menu system that updates depending on the
page that you are on, if a page has sub sections and you are on that page or
one of the sub sections then the menu will remain expanded.

The database layout is along the lines of : ID | pagetitle | subpage
This results in, for example, 'MyExamplePage' having the values : 12 |
MyExamplePage | 0
But the subpages that are linked to this page having the values : 17 | Menu
Option 1 | 12

The subpage value 12 being attached to the ID of the page that it is a
sub-page of.

Is this the correct way that the database should be layed out in an instance
like this ?

How would I work backwards through it to keep the menu expanded if I am on
the page Menu Option 1 ?

Thanks

J.


'objRS1 is a fixed record for the rest of the page data

'Start Loop
Do

'Write the page title
Response.Write(objRS("pagetitle")) & "<br>"

'Check to see if the record we've just written is the page we're on.
If int(objRS1("ID"))=int(objRS("ID")) Then

' Grab all of the records from the DB with the same subpage value
strQuery2 ="SELECT pagetitle FROM content WHERE subpage='" &
int(objRS1("ID")) & "'"
set objRS2 = objConn.Execute(strQuery2)

'Check to see if there are any & then start writing them
If Not objRS2.EOF then
Do Until objRS2.EOF
Response.Write(objRS2("pagetitle")) & "<br>"
objRS2.MoveNext
Loop
End If
End If

'Start Again
objRS.MoveNext
Loop Until objRS.EOF
Jul 19 '05 #1
0 1389

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: michael | last post by:
How may the following script be modified to function with the list structure below it? In short: it is meant to apply a background style to groups of LI's and ULs depeding on the URL filename. ...
6
by: krimgelas | last post by:
Hello, I am using the technique explained in Negrino & Smith "Javascript for the World Wide Web" to make a sliding menu. The example they give can be found on their companion website: ...
14
by: dawnerd | last post by:
Hi, I am developing a CMS and came across something which has never happened to me before, and I re-wrote the specific script twice, both differently, and still had the same error. I'm not sure...
14
namcintosh
by: namcintosh | last post by:
Hello, everyone. Well, let me cut to the chase and explain my problem. I am trying to devise a menu plan that uses the if/else if and the while loop. The program calculates the user's weight...
2
by: Ravi Joshi | last post by:
The menu on my site works fine in IE6 and Firefox. In IE7, there is a problem with the menu: when you mouse over the various main catagories, the sub-catagories all appear to the right as they...
0
by: mjohnson0321 | last post by:
I am trying to incorporate a CSS drop-down menu into a site (suckerfish menu). The menu gets lost behind the content below it, but only on one of the drop downs (News). The error occurs on all of...
2
by: EGdesign | last post by:
Hi everybody! does anyone know a script to have an eBay-style dropdown menu? (the one that shows up pointing on "Categories") thanx in advance for your answers.
3
by: nyalugwe | last post by:
Hello, I am not at all experienced in Javascript so please bear with me. I'm trying to create a drop-down menu that will work in IE, and trying to use some Javascript code that I got from here. ...
0
by: Slickuser | last post by:
From my PHP page: Grab all data from the database. Go through a loop to generate the HTML. Client side: From the Color drop menu list, if a user change the value. It will grab that value &...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.