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条)

报告相同问题?

悬赏问题

  • ¥100 sql reporting service 远程smtp服务器配置支持
  • ¥15 ppyoloe_r带角度目标检测,loss_cls没法收敛
  • ¥15 淘宝交易指数如何解读,其关联的数据指标是什么
  • ¥15 Linux下安装搜狗拼音不能显示中文
  • ¥15 事件7000导致的自动重启如何解决
  • ¥15 (标签-matlab|关键词-m3)
  • ¥20 做一个web书店,带答辩
  • ¥15 #求带 python,使用pycharm爬取智联招聘数据资源并保存为Excel文件,同时以图表形式呈现
  • ¥15 学校优化算法怎么样,国内用的多吗?
  • ¥15 微信购物商城购物车的所有功能以及购物车,和首页的搜索功能