2011-04-06 94 views
3

添加其他过滤条件这是我的Zend查询如何在Zend框架查询

return $this->fetchRow($this->select()->where('name = ?', $geofence_name)); 

,我想添加其他过滤器在我的查询,因为我想看看另一种情况。

请指导我。

回答

10

对于and where

$select = $db->select() 
    ->from('products', 
     array('product_id', 'product_name', 'price')) 
    ->where('price > ?', $minimumPrice) 
    ->where('price < ?', $maximumPrice); 

对于or where

$select = $db->select() 
    ->from('products', 
      array('product_id', 'product_name', 'price')) 
    ->where('price < ?', $minimumPrice) 
    ->orWhere('price > ?', $maximumPrice);