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