Tyrial101
03-27-2007, 06:52 PM
Hey guys,
I've been trying to add a referrer mod to my PHPBB, but have had little luck so I am attempting to make my own.
I want to make a PHP script that will add 50 to a table field in MySQL every time someone enters a username into a field.
Here is the HTML I am going to add
<input type="text" value="Referrer" />
I want that to add 50 to my MySQL table field "user_refer."
If the user does not exist I want it to ignore that part of the PHP and move on.
So, lets say Johnny joins the forum and was referred by Josh. Josh has 500 referral points. If Johnny submits the form with Josh's name in the Refer field then Josh should receive 50 more points thus making 550. If he spells it Josh "Jsoh," I want the script to continue so Johnny still becomes a registered member.
I am still learning about PHP but I think I got an idea with what I need to do...
Something like
$refer = $_POST['refer']
SELECT user_refer FROM phpbb_users WHERE username = "$refer";
Now, that I have it I need to add 50 to it and then reinsert it.
But, I do not know how to make the above line a variable or how to copy over the existing MySQL entry of 500 and make it 550.
I've been trying to add a referrer mod to my PHPBB, but have had little luck so I am attempting to make my own.
I want to make a PHP script that will add 50 to a table field in MySQL every time someone enters a username into a field.
Here is the HTML I am going to add
<input type="text" value="Referrer" />
I want that to add 50 to my MySQL table field "user_refer."
If the user does not exist I want it to ignore that part of the PHP and move on.
So, lets say Johnny joins the forum and was referred by Josh. Josh has 500 referral points. If Johnny submits the form with Josh's name in the Refer field then Josh should receive 50 more points thus making 550. If he spells it Josh "Jsoh," I want the script to continue so Johnny still becomes a registered member.
I am still learning about PHP but I think I got an idea with what I need to do...
Something like
$refer = $_POST['refer']
SELECT user_refer FROM phpbb_users WHERE username = "$refer";
Now, that I have it I need to add 50 to it and then reinsert it.
But, I do not know how to make the above line a variable or how to copy over the existing MySQL entry of 500 and make it 550.