Zend Db Select "VE"

0 Cevap php

Ben aşağıdaki select var:

$select = self::getConnection()->select()
                           ->setSqlCalcFoundRows(true)
                           ->from(array('person' => parent::$_prefix . self::$_tableName), $rows)
                           ->where($wherePerson['statement'], $wherePerson['value'])
                           ->where($whereOwner['statement'], $whereOwner['value'])
                           ->order($sort .' '. $sortDir)
                           ->limit($limit, $offset);

Now i want to add an additional AND. But only if the field has a value (completed by the user). So when the owner field is empty, may not be the result of my query (see the AND):

SELECT SQL_CALC_FOUND_ROWS xxx
FROM xxxx AS xxxx
WHERE (person_id = '305000270002')
  AND (owner = '')
ORDER BY xxxx ASC
LIMIT 25

Ben gerek yok VE boş, aksi takdirde benim sonuç yanlıştır.

0 Cevap