我有以下代码部分,我正在努力从 Paypal 事务中写入 MySQL 数据库。我只包含了相关的 Zend DB 日志部分,Paypal 界面工作正常,根据数据输出。
$paypalLog = array(
'transactionId' => 'transactionId',
'transactionType' => 'transactionType',
'paymentType' => 'paymentType',
'orderTime' => 'orderTime',
'amt' => 'amt',
'currencyCode' => 'currencyCode',
'feeAmt' => 'feeAmt',
'taxAmt' => 'taxAmt',
'paymentStatus' => 'paymentStatus',
'pendingReason' => 'pendingReason',
'reasonCode' => 'reasonCode'
);
$data = array(
'transactionId' => $transactionId,
'transactionType' => $transactionType,
'paymentType' => $paymentType,
'orderTime' => $orderTime,
'amt' => $amt,
'currencyCode' => $currencyCode,
'feeAmt' => $feeAmt,
'taxAmt' => $taxAmt,
'paymentStatus' => $paymentStatus,
'pendingReason' => $pendingReason,
'reasonCode' => $reasonCode
);
$mapping = array(
'message' => 'message',
'extra' => $data);
print_r($mapping);
$writer = new Zend\Log\Writer\Db($db, 'paypal', $paypalLog);
$logger = new Zend\Log\Logger();
$logger->addWriter($writer);
$logger->info($mapping);
当我运行我的代码时,打印返回以下内容,因此数据可用
Array ( [message] => message [extra] => Array ( [transactionId] => 03V084280U905161H [transactionType] => expresscheckout [paymentType] => instant [orderTime] => 2013-02-12T01:16:40Z [amt] => 9.00 [currencyCode] => AUD [feeAmt] => 0.52 [taxAmt] => 0.00 [paymentStatus] => Completed [pendingReason] => None [reasonCode] => None ) )
我的表定义如下,并且我已授予用户完全权限。
CREATE TABLE `paypal` (
`timestamp` varchar(45) DEFAULT NULL,
`priority` varchar(45) DEFAULT NULL,
`priorityName` varchar(45) DEFAULT NULL,
`message` varchar(45) DEFAULT NULL,
`transactionId` varchar(45) NOT NULL,
`transactionType` varchar(45) DEFAULT NULL,
`paymentType` varchar(45) DEFAULT NULL,
`orderTime` datetime DEFAULT NULL,
`amt` varchar(45) DEFAULT NULL,
`currencyCode` varchar(45) DEFAULT NULL,
`feeAmt` varchar(45) DEFAULT NULL,
`taxAmt` varchar(45) DEFAULT NULL,
`paymentStatus` varchar(45) DEFAULT NULL,
`pendingReason` varchar(45) DEFAULT NULL,
`reasonCode` varchar(45) DEFAULT NULL,
PRIMARY KEY (`transactionId`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1$$
但是,当我在 MySQL 方面运行跟踪时,它只是不断尝试插入空值。
130212 12:19:38 29 Connect user@localhost on database
29 Query INSERT INTO `paypal` () VALUES ()
29 Quit
欢迎任何想法!