Grouping WHERE clauses with Zend_Db_Table_Abstract ?

Answer

In order to achieve this, you have to construct the grouped clause within a single call to the where method.

If both values of conditions are the same, you can do this:

$select->where('client_email = ? OR client_email_alt = ?', $client_email)

If there are multiple placeholders within the string, the DB adapter's quoteInto method will replace all placeholders with the provided value.

If you need to group an OR with different values for each field, you have to manually quote the values. It's a bit more complex:

$select->where(
    $db->quoteInto('client_email = ?', $email1).' OR '. $db->quoteInto('client_email_alt = ?', $email2));// $db is your instance of Zend_Db_Adapter_*// You can get it from a Zend_Db_Table_Abstract //subclass by calling its getAdapter() method

All zend-framework Questions

Ask your interview questions on zend-framework

Write Your comment or Questions if you want the answers on zend-framework from zend-framework Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---