fix variable names of the proposed solution#21
Conversation
|
@ChemiKyle, would you like to review this since you wrote it? |
|
Good catch @mimoun-ellebbar! Your proposed solution works for |
|
Appreciate it @ChemiKyle, but the function logic still unchanged, i just wrangled the variable names so the function would continue to use each variable's data for the right context |
ChemiKyle
left a comment
There was a problem hiding this comment.
Happy to approve once these 2 changes are committed.
@mimoun-ellebbar we typically expect DataCore team members to merge their own PRs after approval (as a reviewer, you'll usually only merge PR from a collaborator without write access to a repository).
| WHERE username IN (' . implode(',', $questionMarks) . ')'; | ||
|
|
||
| $result = $this->query($sql, [$new_value, $users]); | ||
| $result = $this->query($sql, [$new_value, $usernames_data]); |
There was a problem hiding this comment.
| $result = $this->query($sql, [$new_value, $usernames_data]); | |
| $result = $this->query($sql, [$new_value, $users]); |
This needs to be the user array otherwise it only works when only a single user is altered.
There was a problem hiding this comment.
i see what you are saying, but in that case the join/implode logic would be unnecessary, also the $users param would not get accepted, i guess the best approach here, based on source code:
- get rid of join logic for usernames:
$usernames_data = implode('", "', $users); - change the update to this :
$params = array_merge([$new_value], $users); $result = $this->query($sql, $params);
Co-authored-by: Kyle Chesney <kyle.2493@gmail.com>
Pre-flight Checklist
Overview
There’s a bug in the into queries exercise solution. A line of code converts an input variable from an array into a string, but later the solution tries to use that same variable as if it were still an array. Since the original data gets overwritten, the program will crash
Context
Requirements addressed:
Screenshots