Skip to content

Commit

Permalink
Bugfix: Correct use of sql param twice
Browse files Browse the repository at this point in the history
  • Loading branch information
georgmaisser committed Mar 12, 2024
1 parent 39c06a7 commit 01ad98e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions classes/game_control.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,16 @@ public static function get_user_stats(int $userid, $mooduellid = null) {
$returnarray = [];
try {
// Get all the games where player was either Player A or Player B AND game is finished.
$params = ['userid' => $userid];
$sql = "SELECT *
FROM {mooduell_games}
WHERE (playeraid = ' . :userid . '
OR playerbid =' . :userid . ')";
WHERE (playeraid = :userid1
OR playerbid = :userid2)";

$params = [
'userid1' => $userid,
'userid2' => $userid,
];

$data = $DB->get_records_sql($sql, $params);

$wongames = 0;
Expand Down

0 comments on commit 01ad98e

Please sign in to comment.