Fix $db->update when there is null value

This commit is contained in:
slawkens 2024-07-24 17:30:33 +02:00
parent 3e00c52128
commit 1458b7a412

View File

@ -167,8 +167,14 @@ abstract class OTS_Base_DB extends PDO implements IOTS_DB
$query = 'UPDATE '.$this->tableName($table).' SET '; $query = 'UPDATE '.$this->tableName($table).' SET ';
$count = count($fields); $count = count($fields);
for ($i = 0; $i < $count; $i++) for ($i = 0; $i < $count; $i++) {
$query.= $this->fieldName($fields[$i]).' = '.$this->quote($values[$i]).', '; $value = 'NULL';
if ($values[$i] !== null) {
$value = $this->quote($values[$i]);
}
$query.= $this->fieldName($fields[$i]).' = '.$value.', ';
}
$query = substr($query, 0, -2); $query = substr($query, 0, -2);
$query.=' WHERE ('; $query.=' WHERE (';