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..
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
select * from table where referredby=userid;
but as you know this will not solve the problem..as i get point of other members also who was referred by the people who were
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?
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...
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..