@@ 1171-1175 (lines=5) @@ | ||
1168 | $tokens = $fields = $where = []; |
|
1169 | ||
1170 | // Fields with values to update |
|
1171 | foreach ($fields_values as $field => $value) { |
|
1172 | $token = ':' . count($tokens); |
|
1173 | $fields[] = "`{$field}` = {$token}"; |
|
1174 | $tokens[$token] = $value; |
|
1175 | } |
|
1176 | ||
1177 | // Where conditions |
|
1178 | foreach ($where_fields_values as $field => $value) { |
|
@@ 1178-1182 (lines=5) @@ | ||
1175 | } |
|
1176 | ||
1177 | // Where conditions |
|
1178 | foreach ($where_fields_values as $field => $value) { |
|
1179 | $token = ':' . count($tokens); |
|
1180 | $where[] = "`{$field}` = {$token}"; |
|
1181 | $tokens[$token] = $value; |
|
1182 | } |
|
1183 | ||
1184 | $sql = 'UPDATE `' . $table . '` SET ' . implode(', ', $fields); |
|
1185 | $sql .= count($where) > 0 ? ' WHERE ' . implode(' AND ', $where) : ''; |