...

View Full Version : Parent / Child Category Navigation



scraptoft
06-24-2006, 12:21 AM
HI

What I am trying to is build a navigation menu which will echo all the categories from my mysql database with the specificic subcategoires below them. So my navigation echos all Parent (categories) with their children (subcategories)

My database contains: id, category, subcategory.

I.E

Category
-Subcategory

I can query the database so it echos all categories, and then echos all subcategories but the problem I have is each category echos the same subcategory underneath it.

Cheers

guelphdad
06-24-2006, 01:12 AM
me again. check the album/artist link on my signature below if you didn't see it on the other site first.

scraptoft
06-24-2006, 01:44 AM
Thankyou very much for your post(s). I'm working myself through this tutorial right now, it's a bit of an eye opener to MYSQL.

Cheers.

guelphdad
06-24-2006, 05:16 AM
Sorry I also forgot to link this article (http://dev.mysql.com/tech-resources/articles/hierarchical-data.html) on managing hierarchical data.

If you really need to delve into this type of stuff may I also suggest a book by Joe Celko Trees and Hierarchies in SQL for Smarties (http://search.barnesandnoble.com/booksearch/isbnInquiry.asp?z=y&isbn=1558609202&itm=1).

If you are just getting involved with mysql itself that book may be a bit too advanced. The article I've linked though is quite straight forward.

marek_mar
06-24-2006, 11:46 AM
http://www.codingforums.com/showthread.php?t=79773



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum