1

Paypal 一直在发送电子邮件警告 IPN 失败。

我没有对我的代码进行任何更改,而且它确实是旧代码....已经工作了 5 年以上.... 时间太长了,我不得不在这个网站上做任何事情。

我搜索了服务器日志以获取更多信息……这是我反复发现的

|35|80040e14|Syntax_error_(missing_operator)_in_query_expression_'OrderID='.

我检查了网站 ipn 页面上的代码,我被难住了。什么都没有改变,但它停止工作

这是 ipn 页面代码的第 34 到 36 行:

MM_Cmd.CommandText = "UPDATE Orders SET txn_id='" & txn_id & "',payment_status='" & payment_status & "' WHERE OrderID=" & Item_number
MM_Cmd.Execute 
end function

更新:这是显示 Item_number 的完整代码:

<%
str = Request.Form & "&cmd=_notify-validate"

' post back to PayPal system to validate
set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
objHttp.open "POST", "https://www.paypal.com/cgi-bin/webscr", false
objHttp.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
objHttp.Send str

' assign posted variables to local variables
Item_number = Request("item_number")
Payment_status = Request("payment_status")
Txn_id = Request("txn_id")
if (objHttp.status <> 200 ) then
' HTTP error handling
elseif (objHttp.responseText = "VERIFIED") then
if Payment_status = "Completed" then 'only update database if the response text is verified and the payment complete
UpdateOrder
end if
elseif (objHttp.responseText = "INVALID") then
' log for manual investigation
else
' error
end if

set objHttp = nothing

function UpdateOrder
'on error resume next
Set MM_Cmd = Server.CreateObject("ADODB.Command")
MM_Cmd.ActiveConnection = MM_CharonCart_STRING
MM_Cmd.CommandText = "UPDATE Orders SET txn_id='" & txn_id & "',payment_status='" & payment_status & "' WHERE OrderID=" & Item_number
MM_Cmd.Execute 
end function
%>
4

1 回答 1

0

问题出在您的变量 Item_number 上。如果您将查询的结尾重写为

... where OrderID=" & Cint(Item_number)

那么您将解决您的问题,但是您可能需要查看为 Item_number 分配值的代码

于 2013-03-24T01:40:16.480 回答