Ok it seems no matter what i do its not working right, it keeps inserting a new row, even though there is a row with the affid in it.
Only suppose to insert new row if the affid isnt in there.
I been trying different variations and no luck. I am not understanding something or code is all wrong
Can anyone help me out ..
$query = "select * from referralamount where user_id = '$affid' and amount = ''";
$result = mysql_query($query);
$numrows = mysql_num_rows($result);
$refm=00.20;
if ($numrows == 0){
q("insert into referralamount (user_id, amount)values('$affid','$refm')");
}else{
q("update referralamount set amount=amount+'$refm' where user_id='$affid'");
}