mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-27 17:59:22 +02:00
Fix $db->update when there is null value
This commit is contained in:
parent
3e00c52128
commit
1458b7a412
@ -167,8 +167,14 @@ abstract class OTS_Base_DB extends PDO implements IOTS_DB
|
||||
$query = 'UPDATE '.$this->tableName($table).' SET ';
|
||||
|
||||
$count = count($fields);
|
||||
for ($i = 0; $i < $count; $i++)
|
||||
$query.= $this->fieldName($fields[$i]).' = '.$this->quote($values[$i]).', ';
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
$value = 'NULL';
|
||||
if ($values[$i] !== null) {
|
||||
$value = $this->quote($values[$i]);
|
||||
}
|
||||
|
||||
$query.= $this->fieldName($fields[$i]).' = '.$value.', ';
|
||||
}
|
||||
|
||||
$query = substr($query, 0, -2);
|
||||
$query.=' WHERE (';
|
||||
|
Loading…
x
Reference in New Issue
Block a user