Ok well this is the case. I have a mysql database, with a table Menuitems: ID, Name, LinkedID. The idea is this, a menuitem gets an incremented ID, a name, and a linkedID. The linkedID shows which ID is the menu's parent. Now I want the childs to go infinitely deep, meaning I need some sort of query loop. Brief example: [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] ID----Name--------LinkedID 1-----MenuA----------0------ 2-----MenuB----------0------ 3-----SubmenuA-----1------ 4-----SubmenuAA----3----- [/quote] This would produce: [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] MenuA --SubmenuA ----SubmenuAA MenuB [/quote] As you can see, if LinkedID = 0, the menu is not a child, else it is. So everytime LinkedID != 0, a query must be called. How can I loop this?