PHP Trait Bluz\Db\Query\Traits\Where

Required for: - Select Builder - Update Builder - Delete Builder
Author: Anton Shevchuk
Show file Open project: bluzphp/framework

Public Methods

Method Description
andWhere ( $condition ) Add WHERE .
orWhere ( $condition ) Add WHERE .
where ( $condition ) Set WHERE condition

Method Details

andWhere() public method

. AND .. condition Adds one or more restrictions to the query results, forming a logical conjunction with any previously specified restrictions. $sb = new SelectBuilder(); $sb ->select('u') ->from('users', 'u') ->where('u.username LIKE ?', '%Smith%') ->andWhere('u.is_active = ?', 1);
public andWhere ( $condition )
$condition Optional the query restriction predicates

orWhere() public method

. OR .. condition Adds one or more restrictions to the query results, forming a logical disjunction with any previously specified restrictions. $sb = new SelectBuilder(); $sb ->select('u.name') ->from('users', 'u') ->where('u.id = 1') ->orWhere('u.id = ?', 2);
public orWhere ( $condition )
$condition Optional the query restriction predicates

where() public method

Specifies one or more restrictions to the query result Replaces any previously specified restrictions, if any $sb = new SelectBuilder(); $sb ->select('u.name') ->from('users', 'u') ->where('u.id = ?', $id) ;
public where ( $condition )
$condition optional the query restriction predicates