Q:

How to use prepared statements in Zend Framework

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 Framework (I couldn't find it), and how to use it. If not, how would you implement prepared statements as Zend Framework addon.

A:

$sql = "SELECT * FROM table_name WHERE id = :id ";

$stmt  = Zend_Registry::get("db")->prepare($sql);

$data=array(array('id'=> $id);

$stmt->execute($data);

print_r($stmt->fetchAll());

A:

After some research, I didn't find ZF's support for prepared statements in this very same way. The only thing you can do is to emulate it as @Nikita Gopkalo posted.

