@@ 1231-1235 (lines=5) @@ | ||
1228 | $tokens = $fields = $where = []; |
|
1229 | ||
1230 | // Fields with values to update |
|
1231 | foreach ($fields_values as $field => $value) { |
|
1232 | $token = ':' . count($tokens); |
|
1233 | $fields[] = "`{$field}` = {$token}"; |
|
1234 | $tokens[$token] = $value; |
|
1235 | } |
|
1236 | ||
1237 | // Where conditions |
|
1238 | foreach ($where_fields_values as $field => $value) { |
|
@@ 1238-1242 (lines=5) @@ | ||
1235 | } |
|
1236 | ||
1237 | // Where conditions |
|
1238 | foreach ($where_fields_values as $field => $value) { |
|
1239 | $token = ':' . count($tokens); |
|
1240 | $where[] = "`{$field}` = {$token}"; |
|
1241 | $tokens[$token] = $value; |
|
1242 | } |
|
1243 | ||
1244 | $sql = 'UPDATE `' . $table . '` SET ' . implode(', ', $fields); |
|
1245 | $sql .= count($where) > 0 ? ' WHERE ' . implode(' AND ', $where) : ''; |