display last child

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Think Pink
Forum Contributor
Posts: 106
Joined: Mon Aug 02, 2004 3:29 pm

display last child

Post by Think Pink »

I was wondering if there is a way to diaply the last child from a tree

for example this table
treeId | parent | title
1 | null | menu 1
2 | null | menu 2
3 | 1 | submenu 1.1
4 | 3 | submenu 1.1.3.1
5 | 4 | submenu 1.1.3.4.1
..........
150 | 1 | submenu 1......

the output
menu 1
» submenu 1.1
» »submenu 1.1.3.1
» » »submenu 1.1.3.4.1
» » » »submenu 1.....
menu 2

if there a way to display the last child of menu 1?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

The table design you've chosen forces you to query again for additional children.
User avatar
Think Pink
Forum Contributor
Posts: 106
Joined: Mon Aug 02, 2004 3:29 pm

Post by Think Pink »

I thought so.
thx anyway for your reply. This post may be deleted if you think so.
Post Reply