0

In my application, i want to make a dynamic multi layer menu like this

Toy1

==>Sub toy1-a

==>Sub toy1-b

Toy2

==>Sub toy2-a

==>Sub toy2-b

Toy3

==Sub toy3-a

I have created 2 table in database called parent-Menu contain Toy1,Toy2,Toy3 and sub-Menu contain Sub toy1-a, Sub toy1-b and their father which it belongs. I don't know how to retrieve database or algorithm to make this. Anybody have solution ?

tereško
  • 58,060
  • 25
  • 98
  • 150
agmadon
  • 29
  • 2

1 Answers1

0

I can recommend you to use only one table, it will make your program very eaisy.

take 3 field *menu_id* , *menu_text* , *parent_id* for all top menu take parent id 1. now do the following work,

Retrieve all data from the table.

And use the recursive function to the place the menu.

Ankur
  • 111
  • 8