How to mysql escape in magento?

后端 未结 2 1649
借酒劲吻你
借酒劲吻你 2021-02-07 12:49

I want to escape string in magento, but when I am using mysql_real_escape_string, i am getting warning.

Warning: mysql_real_escape_string()

2条回答
  •  盖世英雄少女心
    2021-02-07 13:00

    Use this to escape a string for a query and add the surrounding single quotes:

    Mage::getSingleton('core/resource')->getConnection('default_write')->quote($string);
    

    You can look up Varien_Db_Adapter_Pdo_Mysql for further quoting details if needed.

提交回复
热议问题