Ruzzas Posted May 27, 2010 Share Posted May 27, 2010 if($p->ipn_data['receiver_email']=='donations@nmdgaming.com'){ $amount = $p->ipn_data['mc_gross'] - $p->ipn_data['mc_fee']; mysql_query(" INSERT INTO donations (txn_id,item_number,first_name,last_name,payer_email,amount,mc_gross,mc_fee,receiver,email,payment_type,payment_status,payment_date,payer_business_name,payer_status) VALUES ( '".esc($p->ipn_data['txn_id'])."', '".esc($p->ipn_data['item_number'])."', '".esc($p->ipn_data['first_name'])."', '".esc($p->ipn_data['last_name'])."', '".esc($p->ipn_data['payer_email'])."', ".(float)$amount.", '".esc($p->ipn_data['mc_gross'])."', '".esc($p->ipn_data['mc_fee'])."', '".esc($p->ipn_data['receiver_email'])."', '".esc($p->ipn_data['payment_type'])."', '".esc($p->ipn_data['payment_status'])."', '".esc($p->ipn_data['payment_date'])."', '".esc($p->ipn_data['payer_business_name'])."', '".esc($p->ipn_data['payer_status'])."', '".esc($p->ipn_data['residence_country'])."', '".esc($p->ipn_data['mc_currency'])."', '".esc($p->ipn_data['payer_id'])."', '".esc($p->ipn_data['receiver_id'])."' )"); } It never seems to place any of that data into the mysql, It is overpacked or something? Quote Link to comment Share on other sites More sharing options...
Psycho Posted May 27, 2010 Share Posted May 27, 2010 You should create the query as a string variable and then execute the query. This allows you to echo the query to the page when needed for debugging purposes. You also have no error handling on your query. So, it is likely failing, but you have no way of knowing. I see at least two definit problems and a few possible problems. In the defined fields list there are two fields listed that should be one: ...,receiver,email,... Based upon the values you are using I think that should be a single field called "receiver_email". Also, in the values to populate in the database you have more values defined than you have fields. The last for values are not in the defined list. I found it pretty easy when I was reformmatting the code into a more logic format. If you follow some sort of standard these types of problems are easily avoided. <?php if($p->ipn_data['receiver_email']=='donations@nmdgaming.com') { //Prepare values $tax_id = esc($p->ipn_data['txn_id']); $item_number = esc($p->ipn_data['item_number']); $first_name = esc($p->ipn_data['first_name']); $last_name = esc($p->ipn_data['last_name']); $payer_email = esc($p->ipn_data['payer_email']); $amount = (float) ($p->ipn_data['mc_gross']-$p->ipn_data['mc_fee']); $mc_gross = esc($p->ipn_data['mc_gross']); $mc_fee = esc($p->ipn_data['mc_fee']; $receiver_email = esc($p->ipn_data['receiver_email']); $payment_type = esc($p->ipn_data['payment_type']); $payment_status = esc($p->ipn_data['payment_status']); $payment_date = esc($p->ipn_data['payment_date']); $payer_business_name = esc($p->ipn_data['payer_business_name']); $payer_status = esc($p->ipn_data['payer_status']); $residence_country = esc($p->ipn_data['residence_country']); $mc_currency = esc($p->ipn_data['mc_currency']); $payer_id = esc($p->ipn_data['payer_id']); $receiver_id = esc($p->ipn_data['receiver_id']); //Create query $query = "INSERT INTO donations (`txn_id`, `item_number`, `first_name`, `last_name`, `payer_email`, `amount`, `mc_gross`, `mc_fee`, `receiver_email`, `payment_type`, `payment_status`, `payment_date`, `payer_business_name`, `payer_status`, `residence_country`, `mc_currency`, `payer_id`, `receiver_id`) VALUES ('{$tax_id}', '{$item_number}', '{$first_name}', '{$last_name}', '{$payer_email}', '{$amount}', '{$mc_gross}', '{$mc_fee}', '{$receiver_email}', '{$payment_type}', '{$payment_status}', '{$payment_date}', '{$payer_business_name}', '{$payer_status}', '{$residence_country}', '{$mc_currency}', '{$payer_id}', '{$receiver_id}')"; //Execute query $result = mysql_query($query) or die("Error:<br />".mysql_error()."<br />Query:<br />$query");; } ?> Quote Link to comment Share on other sites More sharing options...
Psycho Posted May 27, 2010 Share Posted May 27, 2010 By the way, you have some poorly written javascript on your site. When I hover over a forum listing my CPU usage for IE jumps up to almost 50% for a half second - then the forum listing gets highlighted. That main page is VERY sluggish because of this. Quote Link to comment Share on other sites More sharing options...
Ruzzas Posted May 28, 2010 Author Share Posted May 28, 2010 By the way, you have some poorly written javascript on your site. When I hover over a forum listing my CPU usage for IE jumps up to almost 50% for a half second - then the forum listing gets highlighted. That main page is VERY sluggish because of this. Blame PHPBB3 Quote Link to comment Share on other sites More sharing options...
Ruzzas Posted May 28, 2010 Author Share Posted May 28, 2010 It worked perfectly, Thank you just one typo you had: $mc_fee = esc($p->ipn_data['mc_fee']; You forgot the ) before the ; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.