What would be the best way to retrieve a menu structure with all the childeren?
I have a column in the database like
id | parent_id | name
2 1 cows
3 1 birds
4 3 eagles
5 3 sparrows
All i can think off right now is to get all items then create a function to loop every item.. then do a query on every item to see if any rows have the same with parent id as it's own id.. and do the same again for that child. But that would require me to do many queries if the menu would grow large. Does anybody have any suggestions, example's, ideas to create this in a cleaner way ?