Organizational Research By

Surprising Reserch Topic

Zend DbTable add where in if() statement

I get my data by this way:

$table = new Application_Model_DbTable_FooBar();

$data = $table
->where('id = ?', (int) $id)

and want to add a separate where clause in an if() statement.
Something like that:

if($foo == "bar") {
    $data->where('foo = ?, 'bar');

So I tried something like that, but it didn't work.

$table = new Application_Model_DbTable_FooBar();

->where('id = ?', (int) $id);

if($foo == "bar") {
    $table->where('foo = ?, 'bar');

$data = $table->query()->fetchAll();

asked Dec 10, 2013 in Zend by rajesh
0 votes

Related Hot Questions

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.