select * from persons where (personLastName='Doe' and personBirthYear=1980) or (fatherLastName='Doe' and fatherBirthYear=1980) or (motherLastName='Doe' and motherBirthYear=1980)
$personQuery = array('personLastName' => $lastName, 'personBirthYear' => $birthyear); $fatherQuery = array('fatherLastName' => $lastName, 'fatherBirthYear' => $birthyear); $motherQuery = array('motherLastName' => $lastName, 'motherBirthYear' => $birthyear); $query->where($personQuery); $query->orCondition($fatherQuery); $query->orCondition($motherQuery); // also tried this $query->where(array( $personQuery, $fatherQuery, $motherQuery ), xPDOQuery::SQL_OR);
This question has been answered by Jako. See the first response.
$query = $modx->newQuery('whateverClass') $c->where(array( array('personLastName' => $lastName, 'personBirthYear' => $birthyear), array('OR:fatherLastName' => $lastName, 'fatherBirthYear' => $birthyear), array('OR:motherLastName' => $lastName, 'motherBirthYear' => $birthyear) ));
$c->prepare(); die($c->toSql());