I have set up IPN with paypal to get the variables put into a mysql database but I would like to take one of those variables and add it to another table.
What I have currently is below. It is supposed to check to see if the email address is already in the other table and then if it’s not, it should add it. Can anyone see a problem with the SQL or PHP as it’s not adding the email address to the 2nd table.
[code=php]//insert email into members database
//create MySQL connection
$Connect = @mysql_connect($DB_Server, $DB_Username, $DB_Password)
or die(“Couldn’t connect to MySQL:<br>” . mysql_error() . “<br>” . mysql_errno());
//select database
$Db = @mysql_select_db($DB_DBName, $Connect)
or die(“Couldn’t select database:<br>” . mysql_error(). “<br>” . mysql_errno());
$sql1 = ‘SELECT * FROM members WHERE emailaddress = $payer_email’;
$result1 = mysql_query($sql1);
if(!$result1){
$sql2 = “INSERT INTO members(emailaddress) VALUES (‘” . $payer_email . “‘)”;
$result2 = mysql_query($sql2);
}