From: Ævar Arnfjörð Bjarmason Date: Thu, 14 Jul 2005 17:00:54 +0000 (+0000) Subject: * Make it possible to use the Database.php class to make queries like X-Git-Tag: 1.5.0beta4~129 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/modifier.php?a=commitdiff_plain;h=390126e92b9be14bfa6fafb10e315981f6058ac6;p=lhc%2Fweb%2Fwiklou.git * Make it possible to use the Database.php class to make queries like SELECT * FROM user WHERE user_id = user_name; (note the lack of quotes), use array('user_id' => array(false, 'user_name')) to do this. --- diff --git a/includes/Database.php b/includes/Database.php index 98bf45eddf..c4d90ca10b 100644 --- a/includes/Database.php +++ b/includes/Database.php @@ -967,13 +967,15 @@ class Database { } if ( $mode == LIST_AND && is_numeric( $field ) ) { $list .= "($value)"; - } elseif ( $mode == LIST_AND && is_array ($value) ) { + } elseif ( $mode == LIST_AND && is_array ($value) && $value[0] !== false ) { $list .= $field." IN (".$this->makeList($value).") "; + } elseif ( $mode == LIST_AND && is_array ($value) && $value[0] === false ) { + $list .= "$field = {$value[1]}"; } else { if ( $mode == LIST_AND || $mode == LIST_SET ) { $list .= $field.'='; } - $list .= ($mode==LIST_NAMES?$value:$this->addQuotes( $value )); + $list .= ($mode == LIST_NAMES ? $value : $this->addQuotes( $value )); } } return $list;