I'm creating a cms, I want to produce a set of unordered lists for a nav drop down menu. First, I select all of the menus and links from the database, then I want them to be outputed as unordered lists using php (including the 'main' list's 'child' list if there is one) How do I do it?
Main list-> <li><a href="#">Products</a>
<ul>
Child list-> <li><a href="#">Foo</a></li>
</ul>
</li>
The result you get from database is stored as an array, you can do a foreach loop and iterate over the database result and do like this: