这是 payment_customer 表的表结构。
CREATE TABLE IF NOT EXISTS `payment_customer` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`added_date` datetime NOT NULL,
`merchant_reference_no` varchar(20) NOT NULL,
`amount` int(10) NOT NULL,
`order_desc` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ;
上表存储有关付款客户的数据。我使用以下查询将数据插入到我的自定义支付网关模块中的表中。
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
$sql = " INSERT INTO payment_customer ('id', 'added_date', 'merchant_reference_no', 'amount', 'order_desc') VALUES (NULL, '2013-02-13 00:00:00', '233AX23', '200', 'test'); ";
$write->query($sql);
然后我尝试了
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
$sql = " INSERT INTO sampath_payment_customer ('id', 'added_date', 'merchant_reference_no', 'amount', 'order_desc') VALUES (?, ?, ?, ?,?); ";
$write->query($sql, array('NULL', '2013-02-13 00:00:00', '233AX23', '200', 'test'));
$write->save();
但是两者都没有插入任何数据,而是给我下面的错误消息。
我怎样才能解决这个问题 ?