IPN -处理空字符串


IPN - Handle empty string

使用paypal的IPN我这样做:

$variable1 = "string";
$variable2 = "";
$test = array('cmd'=>'_xclick',
                        'business'=>'email@email.com',
                        'notify_url'=> 'url/to/ipn-script',
                        'item_name'=>'product',
                        'amount'=>'1.00',
                        'currency_code'=>'USD',
                        'lc'=>'US',
                        'custom'=>serialize( array( "variable1" => $variable1,"variable2" => $variable2)));
                        $url = "https://www.sandbox.paypal.com/cgi-bin/webscr?".http_build_query($test);
                        header("Location:".$url);
                        exit();

使用这个代码我得到这个错误:

Failure: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an
error in your SQL syntax; check the manual that corresponds to your MySQL server
version for the right syntax to use near 'NULL,'.',NULL)'

我可以在url中发送空字符串并在ipn-script中处理它们吗?

问候!

似乎你有MySQL错误而不是PayPal错误?

从你的脚本我不能告诉什么查询可能正在执行。尝试用空白值替换'custom',看看错误是否消失,如果您认为这是罪魁祸首。

作为旁注,请记住自定义变量有200个字符限制IIRC