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 ? Link to comment https://forums.phpfreaks.com/topic/35098-query-help-loop-member-list/ 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] Link to comment https://forums.phpfreaks.com/topic/35098-query-help-loop-member-list/#findComment-165865 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.