diff options
author | Filipp Lepalaan <filipp@mekanisti.fi> | 2009-11-18 13:53:52 +0200 |
---|---|---|
committer | Filipp Lepalaan <filipp@mekanisti.fi> | 2009-11-18 13:53:52 +0200 |
commit | 9fa1d072fd90f5c5a2132837e62f4a9dab6a06c2 (patch) | |
tree | 4958ceb9b1198509ac6ee6d1cb3d50980581d7f1 | |
parent | a14477fd1140d09c3079b3477be265cc5e1410da (diff) | |
download | main-9fa1d072fd90f5c5a2132837e62f4a9dab6a06c2.tar.gz main-9fa1d072fd90f5c5a2132837e62f4a9dab6a06c2.tar.bz2 main-9fa1d072fd90f5c5a2132837e62f4a9dab6a06c2.zip |
Controller fixes
-rw-r--r-- | Controller.php | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Controller.php b/Controller.php index 14b7900..34f675b 100644 --- a/Controller.php +++ b/Controller.php @@ -89,7 +89,7 @@ class Controller } $tmp = (empty($q)) ? ' WHERE ' : ' AND '; - $q .= $tmp . $col . ' ' . $op . ' ?'; + $q .= $tmp . "`{$col}`" . ' ' . $op . ' ?'; } } else { @@ -303,7 +303,11 @@ class Controller } $query = ""; $values = array(); - $data = array_merge($data, $where); + list($col, $val) = each($where); + + if (!isset($data[$col])) { + $data = array_merge($data, $where); + } foreach ($data as $k => $v) { $query .= "`$k` = :$k, "; @@ -311,8 +315,6 @@ class Controller } $query = rtrim($query, ", "); - list($col, $val) = each($where); - $sql = "UPDATE `{$this->table}` SET $query WHERE `$col` = :$col"; return Db::query($sql, $values); |