1
这是payment_customer表的表结构。Magento自定义查询插入数据到数据库
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();
但两者不插入任何数据,而不是它给了我下面的错误消息。
我该如何解决这个问题?
检查错误报告你收到了什么错误? – Mufaddal 2013-02-12 05:34:07
这就是我得到的错误 – Techie 2013-02-12 05:38:34