Multi level menu with PHP/MySQL
I'm trying to create dynamic multi level menus fetching the data from a MySQL DB, using PHP. I've managed to order the menu items in a php array with this format:
The problem is that I can't figure out how to output this array as HTML markup in a way that will work with n levels. I can do it with a fixed number of levels like this:
But this only works for 3 levels, and I know there should be a way to solve this issue, I know I'm not the first one facing a problem with HTML output of a multidimensional array.