User Referral System using PHP and MySQL

拟墨画扇 提交于 2019-12-03 08:51:25

Set the referral table as follows:

referrals:
    id (primary key)
    referrer_id (user who is referring someone else)
    referred_email (email of person being referred)
    status (referred[default], registered)
    created_on
    updated_at

Following the policy "do not trust anybody" you should not use name as a field in referrals. Eg. I send a referral: email=>your_email, name=>abuse. It demotes you.

For counting no. of referrals:

select count(*) as referral_count from referrals where referrer_id = 'user_id'
Dhruvi Mistry

I found one query on that as I am making the same module. If the referral link is sent to another person who was not referred by the user, then what will you suggest:

(1) Either allow that person to register and pay to the user (As that can bring more users to site.) (2) Allow that person to register , but don't pay.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!