Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions MysqliDb.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,15 +227,28 @@ public function delete($tableName, $numRows = null)
* This method allows you to specify multipl (method chaining optional) WHERE statements for SQL queries.
*
* @uses $MySqliDb->where('id', 7)->where('title', 'MyTitle');
* @uses $MySqliDb->where( array('id' => 7, 'title' => 'MyTitle') );
*
* @param string $whereProp The name of the database field.
* @param mixed $whereProp The name of the database field. Can also be an array of key/value pairs.
* @param mixed $whereValue The value of the database field.
*
* @return MysqliDb
*/
public function where($whereProp, $whereValue)
public function where($whereProp, $whereValue = null)
{
$this->_where[$whereProp] = $whereValue;
// Process an array if given
if ( is_array( $whereProp ) AND is_null( $whereValue ) )
{
foreach ( $whereProp as $key => $val ) {
$this->where($key, $val);
}
}

// Otherwise, process single key/value arguments.
else {
$this->_where[$whereProp] = $whereValue;
}

return $this;
}

Expand Down