Menu Needs
SQL Need.
I need the most efficient SQL query I can find that returns a dataset being used to build a website navigation menu.
This is a typical navigation menu in most respect however it must allow for unlimited nesting.
So there are two main fields. The item_id and item_parent. Every item has an id and every item has a parent - except the root heading which is assigned an item_parent of 0.
A php sql query must be written in such a way that it recurses through every item, notes its parent item and builds a hierarchal tree structure from hierarchal structure noted.
For instance
Heading 0
......Item 0
......Item 1
............Item 0
..................Item 0
..................Item 1
............Item 1
............Item 2
......Item 2
Heading 1
......Item 0
......Item 1
......Item 2
Heading 3
......Item 0
......Item 1
......Item 2
............Item 0
......Item 3
I have attached a mysql sql file which you can import for use. Please incorporate the item_title which would serve as the Item Text and also href the item_link.