当前正在开发PrestaShop付款模块,并且在更新数据库中的自定义列时遇到问题
$sql = 'UPDATE `'._DB_PREFIX_.'Webpay_transactions`
SET `Customer_id` = '.(int)$customer->id.',
`ResponseCode`= '.pSQL($responsecode).',
`ResponseDescription`='.pSQL($desc).',
`ApprovedAmount`= '.(int)$transamount.',
`ReturnedReference`= '.pSQL($retRef).',
`CardNumber`='.(int)$cardNum.',
`Order_reference`= '.(int)$this->module->currentOrder.'
WHERE `TransactionRef` = '.(int)$txn_ref.'';
Db::getInstance()->execute($sql);
答案 0 :(得分:0)
好的,我弄清楚了问题的根源。 TransactionRef变量具有不正确的特殊字符;已转义。我不得不进行一些事实调查,终于找到了解决方案。
$txn_ref = "TXN|EDUCON|798004|6|131"
Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'Webpay_transactions`
set Customer_id =\''.(int)$customer->id.'\',
ResponseCode = \''.pSQL($responsecode).'\',
ResponseDescription = \''.pSQL($desc).'\',
ApprovedAmount = \''.(int)$transamount.'\',
ReturnedReference = \''.pSQL($retRef).'\',
CardNumber = \''.(int)$cardNum.'\',
Order_reference = \''.(int)$this->module->currentOrder.'\'
WHERE TransactionRef = \''.pSQL($txn_ref).'\'');