dongzhan1383 2011-03-06 01:51
浏览 53
已采纳

PHP MySQL IPN问题

I'm using a PayPal IPN script to process subscription payments on my new project. Everything seems to work great but for some reason when the payment is processed and accepted my databases just don't update.

This is the part of the IPN script to update my databases:

$p->add_field('cmd','_xclick-subscriptions');
$p->add_field('no_note','1');
$p->add_field('currency_code','USD');
$p->add_field('a3', "0.01");
$p->add_field('t3', "M");
$p->add_field('p3', "1");
$p->add_field('src', "1");
$p->add_field('sra', "1");
$p->add_field('business', "myemail@gmail.com");
$p->add_field('return', "http://myurl.com/");
$p->add_field('cancel_return', $this_script.'?action=cancel');
$p->add_field('notify_url', $this_script.'?action=ipn');
$p->add_field('item_name', "My Package Thing ($_POST[hash])");
$p->add_field('custom', "$_POST[hash]");

$p->submit_paypal_post();
      //$p->dump_fields();
      break;
    case 'success':
      echo "<html><head><title>Success</title></head><body><h3>Thank you for your order.</h3>";
      echo "</body></html>";
      break;
    case 'cancel':
      echo "<html><head><title>Canceled</title></head><body><h3>The order was canceled.</h3>";
      echo "</body></html>";
      break;
    case 'ipn':
if ($p->validate_ipn()) {
include("config.php");
$select = mysql_query("UPDATE `mydb_accounts`.`accounts` SET `active` = '1' WHERE `accounts`.`hash` = '$_POST[hash]';") or die(mysql_error());
mysql_query($select);
} break; }

$_POST[hash] works fine because when the "PayPal Payment Page" appears it's shown the item description.

Any thoughts? Thanks!

  • 写回答

2条回答 默认 最新

  • dpgu5074 2011-03-06 08:28
    关注

    Be sure that you mysql_connect in your config file (not only set database info).

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?