Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Categories Tree???

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi,

Can anyone give me a code which can make a tree out of a table in a DB?

I have this table - Categories, with 3 fields: ID,Name,ParentID
no matter what I've tried I couldn't manage to build a simple tree out of this table...

Anyone?

Thanks a lot!
Mike
 
Something that looks like that:

Cars
BMW
Mercedes
Porche
Audi
Audi TT
Crysler

Just to show this on the screen from the table I've written about before.

Thanks
Mike
 
Off the top of my head I would try getting one recordset at a time.

ie.

get all of your category types and store those in an array(BMW, Audi, Porsche)
then get the first of that category and get all with that value(Zclass,Mclass,RClass)
then output the header to the category
followed by the details.
You could do this for however many levels you wanted.
if you wanted to list each car by class then. store those in an array and retrieve the first one query for it, and do the output like above.
Use for loops to go through the arrays.

Walt III
SAElukewl@netscape.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top