Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion exercises/intro_to_queries/IntroQueriesModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function gatherUsers() {
}

public function alterUsers($users, $new_value) {
$users = implode('", "', $users);
$usernames_data = implode('", "', $users);
// FIXME: write and run the SQL command, log what was done

return $result;
Expand Down
8 changes: 4 additions & 4 deletions guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ Read the [Method Documentation](methods/README.md). Search for the `query` funct
$sql = 'SELECT username
FROM redcap_user_information';

$result = $this->query($sql);
$result = $this->query($sql, []);

/* stop writing here */
// parse the mysqli response object into an array
Expand All @@ -329,7 +329,6 @@ Read the [Method Documentation](methods/README.md). Search for the `query` funct
}

function alterUsers($users, $new_value) {
$users = implode('", "', $users);
// FIXME: write and run the SQL command, log what was done

$questionMarks = [];
Expand All @@ -341,11 +340,12 @@ Read the [Method Documentation](methods/README.md). Search for the `query` funct
SET allow_create_db = ?
WHERE username IN (' . implode(',', $questionMarks) . ')';

$result = $this->query($sql, [$new_value, $users]);
$params = array_merge([$new_value], $users);
$result = $this->query($sql, $params);

if ($result) {
// Log what was done if successful
$this->log("Set allow_db to $new_value for users: \"$users\"");
$this->log("Set allow_db to $new_value for users: \"".implode(",",$users)."\"");
}

return $result;
Expand Down