Skip to content

Commit a9cb10e

Browse files
committed
#1 - Fix WHERE clause computation in update()
1 parent ec6d5bf commit a9cb10e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/TgDatabase/Database.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,14 +219,14 @@ public function update($table, $fields, $where) {
219219
else $value = $this->prepareValue($v);
220220
$values[] = '`'.$k.'`='.$value;
221221
}
222-
if (($where != NULL) && !trim($where)) $where = ' WHERE '.$where;
222+
if (($where != NULL) && (trim($where) != '')) $where = ' WHERE '.$where;
223223
$sql = 'UPDATE '.$table.' SET '.implode(', ', $values).$where;
224224
Log::debug($sql);
225225
$rc = $this->query($sql);
226226
if ($rc === FALSE) {
227227
$this->logError($sql);
228228
} else {
229-
$rc = $this->queryList('SELECT * FROM '.$table.' WHERE '.$where);
229+
$rc = $this->queryList('SELECT * FROM '.$table.$where);
230230
}
231231
return $rc;
232232
}

0 commit comments

Comments
 (0)