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