Zend_db fill in multiple placeholders

Jan 11, 2011 zend-framework
This post is more than 18 months old. Since technology changes too rapidly, this content may be out of date (but that's not always the case). Please remember to verify any technical or programming information with the current release.

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:

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