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