Results 1 to 3 of 3

Thread: Crawling through a menu tree

  1. #1
    Join Date
    Oct 2009

    Question Crawling through a menu tree

    I'm working on a light-weight CMS and I have a table of menu items that I want to administer. The relevant fields for this question are

    menu_item_id (PRIMARY KEY)
    menu_item_status(PUBLISHED, UNPUBLISHED, TRASH)

    If there are sub-menus, their menu_item_parent is set to the menu_item_id of the parent menu item. If I change the menu_item_status of a parent, I want the effect to cascade down through all the child menus, however many levels deep.

    I tried doing this with a recursive function in PHP but the process would hang on me. I'd rather do it on the level of MYSQL if that's possible. Is there a MYSQL solution for this?

  2. #2
    Join Date
    Oct 2009

  3. #3
    Join Date
    Aug 2004
    You might also consider using a nested set hierarchical structure for the data instead of the parent/child (adjacency list) structure.
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center