How to use prepared statements in Zend Framework

后端 未结 4 1930
春和景丽
春和景丽 2021-01-13 19:46

Mysql supports prepared statements in this way:

http://dev.mysql.com/doc/refman/5.0/en/sql-syntax-prepared-statements.html

Is there a support for it in Zend

4条回答
  •  清酒与你
    2021-01-13 20:13

    You can try like this

    $sql = "SELECT * FROM table_name WHERE id = :id'";
    $stmt = new Zend_Db_Statement_Pdo($this->_db, $sql); 
    $stmt->execute(array(':id' => $id));
    

提交回复
热议问题