MySql query not being executed
I have recently downloaded and modified a IPN listener, and I want it to do something more than log the donation, but to add points to a user. However it doesn't do anything even though I am sure my code is correct. The first Mysql_Query works and logs the donation but the second one doesnt. I need help, please!
//require paypal, connection and config
$p = new paypal_class;
$p->paypal_url = $payPalURL;
if ($p->validate_ipn())
{
if($p->ipn_data['payment_status']=='Completed')
{
$amount = $p->ipn_data['mc_gross'] - $p->ipn_data['mc_fee'];
mysql_query("INSERT INTO dc_donations( transaction_id, donor_email, amount, original_request)
VALUES (
'".esc($p->ipn_data['txn_id'])."',
'".esc($p->ipn_data['payer_email'])."',
".(float)$amount.",
'".esc(http_build_query($_POST))."'
)");
mysql_query("INSERT INTO dc_credits (SteamID,Credits)
VALUES ('TEST','1000')");
}
}
function esc($str)
{
global $link;
return mysql_rea开发者_Python百科l_escape_string($str,$link);
}
btw, If you need further code than I will add it
You can try putting the 2nd mysql_query first so that it gets executed first and if there is error, you can see the error without inserting to the other table.
精彩评论