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