My database is like this:
kei, parent, lpos, name, url
I need it to be sorted like this:
SELECT * FROM menu ORDER BY parent, lpos
Where parent==kei, I need that row to be inserted into the menu as a submenu item.
Example:
KEI: 60, Parent: 0, Lpos:1, Home
KEI: 61, Parent: 0, Lpos:2, About Us
KEI: 72, Parent: 0, Lpos:3, Agents
KEI: 83, Parent: 0, Lpos:4, Sell A Home
KEI: 85, Parent: 0, Lpos:5, Buy A Home
KEI: 66, Parent: 0, Lpos:6, Search Listings
KEI: 64, Parent: 0, Lpos:7, Commercial
KEI: 65, Parent: 0, Lpos:8, Land
KEI: 68, Parent: 0, Lpos:9, Photos
KEI: 69, Parent: 0, Lpos:10, Links
KEI: 70, Parent: 0, Lpos:11, Contact Us
KEI: 73, Parent: 0, Lpos:12, Careers
KEI: 74, Parent: 73, Lpos:0, Licensing
KEI: 81, Parent: 73, Lpos:1, Is Real Estate For You?
KEI: 77, Parent: 73, Lpos:2, Why Allison-Lacy?
KEI: 90, Parent: 73, Lpos:3, All About Allison-Lacy
KEI: 89, Parent: 73, Lpos:4, Preparing for Your Interview
KEI: 80, Parent: 73, Lpos:5, Contact Us
KEI: 87, Parent: 73, Lpos:6, Referral Program
KEI: 84, Parent: 83, Lpos:0, Homeseller Tips
KEI: 62, Parent: 83, Lpos:1, Properties Search
KEI: 63, Parent: 85, Lpos:5, Properties Search
I'd need that to appear as:
Home
About Us
Agents
Sell A Home
--Homeseller Tips
--Properties Search
Buy A Home
--Properties Search
Search Listings
Commercial
Land
Photos
Links
Contact Us
Careers
--Licensing
--Is Real Estate For You?
--Why Allison-Lacy?
--All About Allison-Lacy
--Preparing for Your Interview
--Contact Us
--Referral Program