summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--it_dbi.class8
1 files changed, 4 insertions, 4 deletions
diff --git a/it_dbi.class b/it_dbi.class
index d08f63f..b783e58 100644
--- a/it_dbi.class
+++ b/it_dbi.class
@@ -655,11 +655,11 @@ function update($tags = array(), $query = null)
/* Pre-processing, $tags is passed by reference and may be modified here */
$this->_write_pre_process($tags);
- if (!$query && !empty($this->_p['keyfield']))
- $query = array($this->_p['keyfield'] => $this->_data[$this->_p['keyfield']]);
-
- if ($set = $this->_set($tags))
+ if ($set = $this->_set($tags, isset($query)))
{
+ if (!isset($query))
+ $query = array($this->_p['keyfield'] => $this->_data[$this->_p['keyfield']]);
+
if ($result = $this->query("UPDATE {$this->_p['table']} $set " . $this->_where($query, $this->_link)))
{
if (array_key_exists($this->_p['keyfield'], $tags)) # Did we just update the key?