ffxpwns Posted May 16, 2012 Share Posted May 16, 2012 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 https://forums.phpfreaks.com/topic/262647-how-would-i-go-about-writing-a-referral-script/ Share on other sites More sharing options...
Jessica Posted May 17, 2012 Share Posted May 17, 2012 Don't double post. Link to comment https://forums.phpfreaks.com/topic/262647-how-would-i-go-about-writing-a-referral-script/#findComment-1346162 Share on other sites More sharing options...
ffxpwns Posted May 17, 2012 Author Share Posted May 17, 2012 Calm down, I realized I put it in the wrong forum first time. Link to comment https://forums.phpfreaks.com/topic/262647-how-would-i-go-about-writing-a-referral-script/#findComment-1346194 Share on other sites More sharing options...
The Letter E Posted May 17, 2012 Share Posted May 17, 2012 Calm down, I realized I put it in the wrong forum first time. Maybe... update tableName set balance = balance + 10 where nick = 'referralName'; Link to comment https://forums.phpfreaks.com/topic/262647-how-would-i-go-about-writing-a-referral-script/#findComment-1346247 Share on other sites More sharing options...
ffxpwns Posted May 17, 2012 Author Share Posted May 17, 2012 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? Link to comment https://forums.phpfreaks.com/topic/262647-how-would-i-go-about-writing-a-referral-script/#findComment-1346358 Share on other sites More sharing options...
The Letter E Posted May 18, 2012 Share Posted May 18, 2012 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 https://forums.phpfreaks.com/topic/262647-how-would-i-go-about-writing-a-referral-script/#findComment-1346490 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.