mysql - custom query in Magento to insert data to database -



mysql - custom query in Magento to insert data to database -

this table construction of payment_customer table.

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 ;

above table stores info customers made payments. utilize below query insert info table in custom payment gateway module.

$write = mage::getsingleton('core/resource')->getconnection('core_write'); $sql = " insert 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);

then tried

$write = mage::getsingleton('core/resource')->getconnection('core_write'); $sql = " insert 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();

but both not insert info instead gives me below error message.

how can prepare ?

can check file error log record number in var/report/1149745463637 give exact thought error. hope help you.

mysql database magento magento-1.7

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -