Jump to content

How would I go about writing a referral script?


ffxpwns

Recommended Posts

In the database, I have a table called 'users' inside that I have email, nick (aka username), and balance.  The individual aspects are set up, and work.  My site is also successfully connecting to and reading / writing info in the database.  So my question is:  How would I go about having a box on the register page called 'refer' where the person would enter their referrers email (or nickname, one or the other) then it finds that person, and puts a value of 10 in 'balance'.  Anyone with more experience than me have any ideas?  All help is greatly appreciated.

Link to comment
Share on other sites

Maybe...

update tableName set balance = balance + 10 where nick = 'referralName';

 

Sweet!  So I'd replace table name with users, and name the text field referralName?

Well, taking the post data it would look like this:

$sql = "update tableName set balance = balance + 10 where nick = '".$_POST['referralName']."'";

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.