data structure help needed

From: Date: Sun, 04 May 2003 15:30:06 +0000
Subject: data structure help needed
Groups: php.db 
Request: Send a blank email to php-db+get-27504@lists.php.net to get a copy of this message
hi all, i am developing a site where users will be related in a parent-child type relationship. my users table is like this:
id     |     user    |    parent
---------------------------------
1      |    joe       |    null
2      |    bill       |    null
3      |   fred      |    1
4      |   john     |    3
5     |   frank     |   3
etc. Any user may have many children - what I want to do is traverse the tree in such a way that I can go up the family tree from any spot and see who is related. Anyone know of a good tutorial or a point in the right direction? I think this will require some recursive statement, which I have not done in PHP or MySQL before. Thanks Charles

« previous php.db (#27504) next »