php - How to make multi-level user referral system

677

I'm working on a multi-level referral system for signup based on PHP, but I can do the signup process to first level only. The referral system levels are managed from administrator control panel.

Table: referral_levels

id          referral_level
--------    --------
1           1
2           2
3           3
4           4

Table: referrals

id          new_user    refferal_level  referral_user_id
--------    --------

On user signup I want to check the following:

1. If the current user who signup is referred by (1)another user - DONE!

2. If the (1)another user has been referred by (2)someone else

3. If (2)someone else is referred again by "x" user and so on...

I'm confused how to write the code for p.2 and p.3 when the signup form is posted and have to check who is referred by who and insert the data for sub-level referrals.

2

Answer

1 7 1 6 2 8 2 6 3 8 1 7 4 9 3 6 5 9 2 7 6 9 1 8 7 10 4 6 8 10 3 7 9 10 2 8 10 10 1 9

People are also looking for solutions to the problem: mysql - Make a flate table in php

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.