在 php mysql Zend 框架中使用多个值和多个字段进行搜索

search with multiple values and in multiple fields in php mysql Zend framework

在这里,我有三个多select组合框,即部门名称位置 其中用户可以在每个字段中 select 多个值。我在查询中执行 OR 操作以显示属于至少一个字段的员工姓名。

如果我只选择一个部门名称、职位名称和位置,这会很有效。如果我 select 超过 1 个值,它就不会工作。我必须for-loop部门WHERE条件,指定位置 基于 selected 计数。
我怎么能在这里只循环条件,让它变成 select 'emp_id' from emp_personal' where Department_Id='1' or Department_Id='7' or Designation_Id='6'....

public function listEmployees($searchArray=null, $logEmpId=null,  $formName=null) 
{

$department = $searchArray['Department'];
$designation= $searchArray['Designation'];
$location=$searchArray['Location'];


      $conditions=$this->_db->quoteInto('Department_Id =?', $department);  
      $conditions .= $this->_db->quoteInto('or Designation_Id = ?', $designation);
      $conditions .= $this->_db->quoteInto('or Location_Id = ?', $location);
      $qryEmployees= $this->_db->select()->from(array('En'=>$this->_ehrTables->empJob), array('En.Employee_Id'))->where($conditions)

     ->joinInner(array('E'=>$this->_ehrTables->empPersonal), 'E.Employee_Id = En.Employee_Id', array('Employee_Name'=>new Zend_Db_Expr("CONCAT(E.Emp_First_Name, ' ', E.Emp_Last_Name)")));



 $result = $this->_db->fetchAll($qryEmployees); 
 return $result;


}     

尝试使用 SELECT IN(value1,value2,...)