2014-11-25 2 views
-1

cake php query builder에서 OR 조건과 관련된 문제가 있습니다. 0 결과가 반환됩니다. 내가 간단한 컬럼에 조건을 적용 할 때CakePHP v1.3.15의 다중 OR 조건

$results = $this->paginate('Did', array('Did.ivr_id LIKE ' => $number . "%",'OR'=>array('Did.did LIKE ' => $number . "%"))); 
$result = $this->paginate = array(array('Did.did LIKE' => $number . "%")); 
$this->set('dids', $results); 

그것은

$results = $this->paginate('Did', array('Did.ivr_id LIKE' => $number . "%")); 
$result = $this->paginate = array(array('Did.did LIKE' => $number . "%")); 
    $this->set('dids', $results); 

답변

1

당신은 당신이하거나 또는 배열 내에서 원하는 모든 조건을 둘 필요가 정확한 결과를 제공합니다.

$results = $this->paginate(
    'Did', 
    array(
     'OR'=>array(
      'Did.ivr_id LIKE ' => $number . "%", 
      'Did.did LIKE ' => $number . "%" 
     ) 
    ) 
); 
+0

감사합니다. 그것의 잘 작동 :) –