Well, to build my menu my menu I use a db similar structure like this
2 Services 0 3 Photo Gallery 0 4 Home
With a database structure like yours, it is possible to build the whole HTML menu with a single query and without recursion.
Yes - I will repeat:
This is the approach I always use myself.
Pasted the code here - fully functional:
http://pastebin.com/GAFvSew4
Jump to line 67 to see the interesting part ("get_menu_html").
The main loop starts at line 85.
There are five "customizable" HTML snippets:
(The code could be cleaner if I hadn't worried with tabulation.)
SQL to create and populate sample database is available at the end of the script.
You can try and let us know your thoughts.