mysql_real_escape_string with Zend

前端 未结 4 901
遇见更好的自我
遇见更好的自我 2021-01-19 00:38

I am developing a web application using zend framework. For select statements I have used following way.

Ex:

public function getData($name)
{
  $sql          


        
4条回答
  •  渐次进展
    2021-01-19 01:32

    You could use parameter binding as well, then the method will look like:

    public function getData($name)
    {
      $sql = "SELECT * from customer where Customer_Name = :name";
      return $this->objDB->getAdapter()->fetchAll ($sql, ['name' => $name]);
    }
    

    Then your data will be escaped automatically

提交回复
热议问题