473,386 Members | 1,823 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,386 software developers and data experts.

Catagory Tree

AaronL
99
Hello, it's me again, I'm stumped.

I have a database table that contains catagories for items. The fields in the table are catagoryid, parentid, and description. I want to make a menu that works like the following

Main menu:
Parent 1
Parent 2
Parent 3

Lets say someone clicks on Parent 1, then I want it to look like
Parent 1
- Child 1
-- A child within a child and so on
- Child 2
- Child 3
Parent 2
Parent 3

I can't for the life of me figure out what the code logic is going to be.
May 25 '09 #1
1 1088
prabirchoudhury
162 100+
Expand|Select|Wrap|Line Numbers
  1. Menu table
  2. +--------+--------------+-----------+----------------+
  3.  | catid  | parent_id    | name       | description     |
  4.  +-------+--------------+------------+----------------+
  5.  |  1      | 0          | Parent 1 | description  |
  6.  |  2      | 0          | Parent 2 | description  |
  7.  |  3      | 0          | Parent 3 | description  |
  8.  |  4      | 1          | Child 1   | description  |
  9.  |  6      | 1          | Child 2   | description  |
  10.  |  7      | 1          | Child 3   | description  |
  11.  |  8      | 2          | Child  1  | description  |
  12.  |  9      | 2          | Child  2  | description  |
  13.  |  10     | 3          | Child 1   | description  |
  14.  | 11      | 3          | Child  2  | description  |
  15. +-------+--------------+----------+----------------+
  16.  
1. first in the top level buttons
Main menu:
Parent 1
Parent 2
Parent 3

you make parient buttons where parent_id = 0

2. child buttons for each parent button

when you click on each parent button pass their catid to get child buttons where parent_id = catid (clicked button's catid)

good luck
May 25 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Tree menu using XML | last post by:
I have one XML file that has nodes and sub node and each and every node has the attribute call visible if its value is true then diplay this node else don't display thid node, but this condition i...
4
by: Tarique Jawed | last post by:
Alright I needed some help regarding a removal of a binary search tree. Yes its for a class, and yes I have tried working on it on my own, so no patronizing please. I have most of the code working,...
2
by: New | last post by:
Why does this code insert a node into a binary search tree correctly? If I only inserting going by first digit it works properly but when I try inserting going by the whole ip and the port number...
5
by: Mike | last post by:
Why does this code insert a node into a binary search tree correctly? If I only inserting going by first digit it works properly but when I try inserting going by the whole ip and the port number...
1
by: esakal | last post by:
Hello, I created several control. i want that when the user add them to the toolbox they will appear under custom name catagory (for example : "Sakal controls"). what is the attribute that i...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.