User Referral System using PHP and MySQL

后端 未结 2 1165
执念已碎
执念已碎 2020-12-16 07:54

I already have a fully pledged membership system and want to integrate my own user referral system but want some tips, advice really on doing it.

My current registe

相关标签:
2条回答
  • 2020-12-16 08:04

    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'
    
    0 讨论(0)
  • 2020-12-16 08:27

    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.

    0 讨论(0)
提交回复
热议问题