Commit b49872e1 authored by Josh Campbell's avatar Josh Campbell

Added "method chaining" to where method

parent 9ced1931
......@@ -209,7 +209,9 @@ class MysqliDB {
}
/**
* This method allows you to specify multipl WHERE statements for SQL queries.
* This method allows you to specify multipl (method chaining optional) WHERE statements for SQL queries.
*
* @uses $MySqliDb->where('id', 7)->where('title', 'MyTitle');
*
* @param string $whereProp The name of the database field.
* @param mixed $whereValue The value of the database field.
......@@ -217,6 +219,7 @@ class MysqliDB {
public function where($whereProp, $whereValue)
{
$this->_where[$whereProp] = $whereValue;
return $this;
}
/**
......
......@@ -100,5 +100,12 @@ $db->where('id', int);
$db->where('title', string);
$results = $db->get('tableName');
print_r($results); // contains array of returned rows
Optionaly you can use method chaining to call where multiple times without calling referancing your object over an over:
$results = $db->where('id', 1)
->where('title', 'MyTitle')
->get('tableName');
print_r($results); // contains array of returned rows
</code>
</pre>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment