diff options
author | Phil Sturgeon <email@philsturgeon.co.uk> | 2011-12-20 11:34:55 +0100 |
---|---|---|
committer | Phil Sturgeon <email@philsturgeon.co.uk> | 2011-12-20 11:34:55 +0100 |
commit | fec2f59721af5721ede0d2b60075910a6b646c03 (patch) | |
tree | 3aabfb00dbd055af10c376271d874cae8d292f49 /system/database/drivers | |
parent | dc3e4bedb39afe30d95635e5258aaecec4dfd74c (diff) | |
parent | 0d91fd2956812e07905d8047ef95a0e556edbb1a (diff) |
Merge pull request #801 from Mancy/master
Fixed issue #798: Update with Like now works
Diffstat (limited to 'system/database/drivers')
-rw-r--r-- | system/database/drivers/mysql/mysql_driver.php | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php index 828ef006b..6ded6e531 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,16 @@ 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; |