i have made a point system for user
ok system is like this
a user is referred by some body to be member ..s/he send the link to friends like
http://www.site.com/signup.php?ref=userid
i have database table which has
id name add,email,password,refferedby field...
in that refferedby field the id of the person who has referred gets in and for every such refferral sign up the user(who has
sent that signup link with id) gets some points.
Interesting things begins here
if the person who was referred by x (supppose y) refers it to somebody with his/her id ,/she she earns to point but at the
same time the original referrer who has referred y (the x) also earns the points
who ever below y makes member along with y x also gets points and so on..
The problem:
i was trying to display the total members made made by member (directly or indirectly,means by memebers made by me)
so the simple logic i could think of is
Code: Select all
select * from table where referredby=userid;reffered by me and this query will only display people who were directly reffered by user of me.
so how can i solve the problem?
graphical view
x-->y (reffred by x)-->z (reffred by x)
when z becomes member, y as well as x earns point and so on in link...
i am trying to calcuate points of x (or members made by x)
i think i need a genuie loop for it but to be frank i thought and thought but seems like beyond reach of my mind
what i hope to get:
may be logic.....or some codes(of that loop will be great)
by the way do i need to introduce additional field in database table
any solution welcomed until it solves problem...
thanks
Note:I pray that i was able to make scenario clear...if i wasn't i am sorry and i hope i can make things clear in further
posts in this topic..
pray people have got it and there any be some logic genius to work out a innovative logic..or code..
thanks