Help:Need a simple php referral code

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Arvkalyan
Forum Newbie
Posts: 1
Joined: Thu Mar 03, 2011 11:54 pm

Help:Need a simple php referral code

Post by Arvkalyan »

I am creating a simple website and i need a simple code for user referral (user can refer his friends and if his friend is registered he get some points for it )
and also it must be entered in the databases...


help me friends....thanx in advance
danwguy
Forum Contributor
Posts: 256
Joined: Wed Nov 17, 2010 1:09 pm
Location: San Diego, CA

Re: Help:Need a simple php referral code

Post by danwguy »

I would say make an array and select a random amount of picks from it, then store that in the database as the referral code. Or you could do something like this...

Code: Select all

$num = range(1, 100);
$rand = array_rand($num, 5);
You now have 5 random numbers between 1 and 100, you can store $rand in the database as referral code and use it however you want.
Post Reply