Aaron Saray

open source programmer,
web developer

entrepreneur, author
and musician

My Blog

contains PHP, Web and business/entrepreneurial related content. Please join in the conversation!

Zend_db fill in multiple placeholders

I’ve been using Zend_db to create a query which does a simple search on three columns of a table. Fortunately, I found out that the where() statement handles single parameters intelligently when there are multiple placeholders. In the case that there are many placeholders but only one parameter, that parameter will be added to each of the placeholders the same.

For example, see this statement:

1
$select->where('email like ? OR first_name like ? OR last_name like ?', array('%' . $q . '%'));

This entry was posted in zend framework and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>