Thanks in advance for any help on this.
I want to build a Conditional query for example.

$package = new Package()

$select = $package->select()->from('packages')->join('customers',
'customers.id = packages.pid)
               ->where('packages.id = ?', 347)->order('recdate DESC');

I want to be able to add to this query based on conditions, for example if 
customer name is filled in the search form add search customer name to this
query as in 

if(!(empty($this->getPost('customer_name')
 {
  // if customer name is provided in the search form then add that search to
the query
 } 

Basically I am trying to reproduce a conditional query like it is done when
u are not using a framework like this

$query = 'Select username, first_name, last_name From table ';
if(!(empty($_POST["date_of_birth"]))
 {
   $query .= ' WHERE date_of_birth=\'$_POST["date_of_birth"] \' ';
}
if(!(empty($_POST["email"]))
 {
   $query .= ' WHERE email=\'$_POST["email"] \' ';

}
and so on, but with the zend framework.

I hoe it's not confusing.

Thanks in advance
-- 
View this message in context: 
http://www.nabble.com/Build-a-conditional-Query-tp21114184p21114184.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to