diff options
author | Mancy <abdullah.mancy@gmail.com> | 2011-12-20 09:47:51 +0100 |
---|---|---|
committer | Mancy <abdullah.mancy@gmail.com> | 2011-12-20 09:47:51 +0100 |
commit | c4caf5a181344e48fc6740f1383dd302f5b604d2 (patch) | |
tree | 10f48ac5edef91f2b5284894c0ca2a3bfab72565 /system/database/drivers | |
parent | d054e137917ef1131195679aa8abeb4dbf69e4e4 (diff) |
taking care of LIKE when used in UPDATE statement #798
Diffstat (limited to 'system/database/drivers')
-rw-r--r-- | system/database/drivers/mysql/mysql_driver.php | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php index 828ef006b..7952312ab 100644 --- a/system/database/drivers/mysql/mysql_driver.php +++ b/system/database/drivers/mysql/mysql_driver.php @@ -606,7 +606,7 @@ class CI_DB_mysql_driver extends CI_DB { * @param array the limit clause * @return string */ - function _update($table, $values, $where, $orderby = array(), $limit = FALSE) + function _update($table, $values, $where, $orderby = array(), $limit = FALSE, $like = array()) { foreach ($values as $key => $val) { @@ -620,6 +620,15 @@ class CI_DB_mysql_driver extends CI_DB { $sql = "UPDATE ".$table." SET ".implode(', ', $valstr); $sql .= ($where != '' AND count($where) >=1) ? " WHERE ".implode(" ", $where) : ''; + + if (count($like) > 0) { + $sql .= ($where == '' AND count($where) <1) ? " WHERE " : ' AND '; + foreach ($like as $st_like) { + + $sql .= " " . $st_like; + + } + } $sql .= $orderby.$limit; |