I get my data by this way:
$table = new Application_Model_DbTable_FooBar();
$data = $table
->select()
->where('id = ?', (int) $id)
->query()
->fetchAll();
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();
$table
->select()
->where('id = ?', (int) $id);
if($foo == "bar") {
$table->where('foo = ?, 'bar');
}
$data = $table->query()->fetchAll();