Ryan
Ryan

Reputation: 18129

Zend DB Table Where Clause

I'm trying to use an array to set the where parameters for a Zend DB Table. I am trying to follow an example in the documentation:

$select = $table->select()->where(array('bug_status = ?' => 'NEW'));

I have a class that inherits Zend_Db_Table and am trying to select like the example:

$select = $this->select()->where(array('FirstName = ?' => 'Ryan'));

But I am getting an error that says "SQLSTATE[42S22]: Column not found: 1054 Unknown column 'Array' in 'where clause'". So it is not recognizing the array as an array and trying to use that as the column name.

Any ideas on whats going on here or how I can get Where to accept an array? Thanks!

Upvotes: 0

Views: 3547

Answers (1)

Lukáš Lalinský
Lukáš Lalinský

Reputation: 41316

The correct syntax is where('FirstName = ?', 'Ryan'). I can't find the array version in the source code, so I'd say it's a "bug" in the documentation.

Upvotes: 5

Related Questions