$write = Mage::getSingleton("core/resource")->getConnection("core_write");
// Concatenated with . for readability
$query = "insert into mage_example "
. "(name, email, company, description, status, date) values "
. "(:name, :email, :company, :desc, 0, NOW())";
$binds = array(
'name' => "name' or 1=1",
'email' => "email",
'company' => "company",
'desc' => "desc",
);
$write->query($query, $binds);
Reference:
http://stackoverflow.com/questions/3575160/using-magento-methods-to-write-insert-queries-with-care-for-sql-injection
http://www.framework.zend.com/manual/en/zend.db.adapter.html
No comments:
Post a Comment