Commit 8e48b720 authored by Alexander Butenko's avatar Alexander Butenko

Allow multiply where parameters

parent df98b68f
......@@ -512,10 +512,15 @@ class MysqliDb
$this->_query .= ' ' . $value[0]. ' ';
if (is_array ($value[1])) {
//value[0] -- AND/OR, value[1] -- condition array
// if the value is an array, then this isn't a basic = comparison
$key = key($value[1]);
$val = $value[1][$key];
switch( strtolower($key) ) {
case '0':
foreach ($value[1] as $v)
$this->_bindParam ($v);
break;
case 'in':
$comparison = ' IN (';
foreach($val as $v){
......
......@@ -127,6 +127,12 @@ $results = $db->get('users');
```
Custom Operators:
```php
$db->where("id = ? or id = ?", Array(6,2));
$res = $db->get ("users");
// Gives: SELECT * FROM users WERE id = 2 or id = 2;
```
```php
$db->where('id', Array('>=' => 50));
$results = $db->get('users');
......
......@@ -187,6 +187,13 @@ if ($db->count != 2) {
exit;
}
$db->where("id = ? or id = ?", Array(1,2));
$res = $db->get ("users");
if ($db->count != 2) {
echo "Invalid users count on select with multiple params";
exit;
}
$db->delete("users");
$db->get("users");
if ($db->count != 0) {
......
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