web.archive.org/web/20110606032941/http://dev.mys… ? maybe this will help?
I can think about several solutions in architecture, personally I would create a referal table with a double primary key 'ref_id' + 'referer_id' where ref_id so you can have things like
| ref_id | referer_id | parent_id |
| 1 | 1 | null |
| 1 | 3 | 1 |
so you have the tree reference outside the main table but it's a lot about design and this is just one solution I came up with on the spot right now.
There most likely are better solutions.