how to script multilevel referal page

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
adsegzy
Forum Contributor
Posts: 184
Joined: Tue Jul 28, 2009 9:26 am

how to script multilevel referal page

Post by adsegzy »

Hello please i need a help on how to script a multilevel referal page. I want it to be that when a member (Eg. Mike) register, he is on level 1, when he refer someone(Eg. Nelson) he(Mike) should move to level 2 and Nelson in level 1. when Nelson refer another person(Eg. Clitton), Clitton should be in level one, Nelson should move to level 2 and Mike should move to level 3 automatically.

Regards.
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: how to script multilevel referal page

Post by social_experiment »

  • 1. Will every member receive a level up when a new person has been refered; or will it just be the person who does the refering and the person refered receiving +1 to their levels?
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
adsegzy
Forum Contributor
Posts: 184
Joined: Tue Jul 28, 2009 9:26 am

Re: how to script multilevel referal page

Post by adsegzy »

No, it is only the person that does the refering and those above him/her that will receive +1.

regards
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: how to script multilevel referal page

Post by social_experiment »

No, it is only the person that does the refering and those above him/her that will receive +1.
I would then say select the person doing the refering (and everyone else above him/her) and just add + 1 to each of the respected levels. If there are already levels existing, they will have to be updated. If you are using a database (which is what my suggestion works on) you would have a SELECT query and an UPDATE query.

Also, what would your database structure look like and how would the referer be tied together with the people above him / her? And if a person with a higher level referers someone, how will incrementing the levels work then? Example : Mike refers bob, bob is then 1 and Mike 4, what about Clitton and Nelson?
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Post Reply