Okay, so I set up a field in mySQL called "ref_num". It's the amount of times a person referred another to the site. The problem I'm having is that there is another auto_increment field in the same table, so I can't have this be an auto_increment as well.
The solution I've thought of, is simply asking mySQL what number is currently there and then adding +1 to it and replacing with the result.
Now, here is my current sql query.
$query2 = "update resellers set active='1' ref_num ='CODEHERE' where id='$item_number'";
What do I add to this query, to make this solution work????
Here's actually what should happen. If BOB signs up, the system first adds his info to the database and knows who referred him by adding their id number to the field "refferer". Then after they pay, it activates their account by setting the "active" field to 1.
Now, after paying through paypal, the current sql query just activates them. But I want to increase the "ref_num" field by 1 for the person that referred them. So the query should look like this:
$query2 = "update resellers set active='1' where id='$item_number' set ref_num=ref_num+1" where id='xy(refferer field in same row as BOB)';
So, what's the correct syntax for this??? updating the active field for the current row (where id=$item_number), then updating the ref_num field by 1 for the person that referred them. We know who referred them because the refferer field tells us the id number of the person that referred them.