Doc error ?

Doc error ?

LapointeLapointe Posts: 404Questions: 76Answers: 4

( location='Scotland' OR location='Canada' ) or ( location='Scotland' AND location='Canada' )

public DataTables\Database\Query    
#where( string|string[]|callable $key, string|string[] $value = null, string $op = "=", boolean $bind = true  )
Where query - **multiple conditions are bound as ANDs.**

Can be used in two different ways, as where( field, value ) or as an array of conditions to use: where( array('fieldName', ...), array('value', ...) );

Single field name, or an array of field names. If given as a function (i.e. a closure), the function is called, passing the query itself in as the only parameter, so the function can add extra conditions with parentheses around the additional parameters.

Single field value, or an array of values. Can be null to search for IS NULL or IS NOT NULL (depending on the value of $op which should be = or !=.

Condition operator: <, >, = etc
Escape the value (true, default) or not (false).
The following will produce 'WHERE name='allan' AND ( location='Scotland' **OR** location='Canada' ):

    ->where( 'name', 'allan' )
    ->where( function ($q) {
      $q->where( 'location', 'Scotland' );
      $q->where( 'location', 'Canada' );
    } );

This question has an accepted answers - jump to answer


This discussion has been closed.