@@ 1281-1285 (lines=5) @@ | ||
1278 | $tokens = $fields = $where = []; |
|
1279 | ||
1280 | // Fields with values to update |
|
1281 | foreach ($fields_values as $field => $value) { |
|
1282 | $token = ':' . count($tokens); |
|
1283 | $fields[] = "`{$field}` = {$token}"; |
|
1284 | $tokens[$token] = $value; |
|
1285 | } |
|
1286 | ||
1287 | // Where conditions |
|
1288 | foreach ($where_fields_values as $field => $value) { |
|
@@ 1288-1292 (lines=5) @@ | ||
1285 | } |
|
1286 | ||
1287 | // Where conditions |
|
1288 | foreach ($where_fields_values as $field => $value) { |
|
1289 | $token = ':' . count($tokens); |
|
1290 | $where[] = "`{$field}` = {$token}"; |
|
1291 | $tokens[$token] = $value; |
|
1292 | } |
|
1293 | ||
1294 | $sql = 'UPDATE `' . $table . '` SET ' . implode(', ', $fields); |
|
1295 | $sql .= count($where) > 0 ? ' WHERE ' . implode(' AND ', $where) : ''; |