orionlogic Posted January 21, 2007 Share Posted January 21, 2007 hi all,I made a php system where members refers friends, and referred person is accepted,or declined, by the person who accepted the referrer.Example:Person A is accepted by Person BPerson A refers Person C to Person BPerson B accept Person Cmember table update=> Person C addedby Person ASo as occurs a hierarchy from top down where people can see who is added the system by whom.My question is: i can't solve the login behind this, also the way of presenting the memberlist in a top down hierarchy format.Anyone have idea ? Quote Link to comment Share on other sites More sharing options...
bibby Posted January 21, 2007 Share Posted January 21, 2007 If you had 3 columns, [ user, friend, referral ] , you could draw them out sorted any way you want.[code]Select * from peopleorder by referral asc , friend asc[/code]I imagine person C's record would be[code]#user | friend | referral# C B A[/code]I guess I don't really understand the exact result you are trying to get, but here's some bonus queries anyhow.[code]# friendliest peopleselect count(*) friends , friendfrom peoplegroup by friendorder by friends desc#most referralsselect count(*) referrals, referral referring_personfrom peoplegroup by referralhaving referrals>1order by referrals desc[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.