As you've specified that this is to be db driven then the main piece of work is the design of the database / tables that you are using
One way would be to have a table that contains a column called "parent". This would then point to the id of the section that the menu belongs to - let me explain with an example
Menu1 (id =1) parent (0)
submenu1(id =2) parent (1)
submenu2(id=3) parent(2)
So as you can see submenu 2 belongs to submenu 1 (by virtue of having the parent point to the id of submenu 1) and submenu 1 belongs to menu 1 (it has the parent pointing to the id of menu1).
Then you can simply add as many submenus as you want (so long as you give each menu a correct parent). The other thing to remember is that the "top" level menus need to have a parent that will allow easy identification as "top level" menus (i've used 0 in this example)
I have used this approach many times and have developed some very very complex menus.
HTH
GM