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