I am currently developing a MLM PHP script, where I need some suggestions OR code examples (would be better) about giving bonus to the all referrers.
Like:
username referrer
-------- --------
A
B A // UPDATE USERNAME A WITH +5 POINTS //
C B // UPDATE USERNAME A WITH +3 POINTS AND USERNAME B WITH +5 POINTS //
D C // UPDATE USERNAME A WITH +3 POINTS AND USERNAME C WITH +5 POINTS //
And so on....
My current registered users table is something like
users (table)
- Ref_ID (referrer User ID)
- UserID
- Email
- password
- points
- created_at
- update_on
I want to know that how can I do the above thing to give points to all upper line users as I mentioned above, I want to do all this in PHP with mysql queries. I am a beginner so therefore I don't know the exact structure to do the similar things. Please guide me to get work on this.