bdaloukas / moodle-mod_game

moodle-mod_game
GNU General Public License v3.0
15 stars 40 forks source link

Database error on mod/game/view.php - Crossword #42

Closed gitTheNamers closed 3 years ago

gitTheNamers commented 3 years ago
Debug info: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
SELECT id,concept FROM mdl_glossary_entries WHERE glossaryid=
[array (
)]

line 486 of /lib/dml/moodle_database.php: dml_read_exception thrown

line 1273 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()

line 188 of /mod/game/check.php: call to mysqli_native_moodle_database->get_records_sql()

line 173 of /mod/game/check.php: call to game_check_common_problems_shortanswer_glossary()

line 49 of /mod/game/check.php: call to game_check_common_problems_shortanswer()

line 337 of /mod/game/view.php: call to game_check_common_problems()
function game_check_common_problems_shortanswer_glossary($game, &$warnings) {
    global $CFG, $DB;

    $sql = "SELECT id,concept FROM {$CFG->prefix}glossary_entries WHERE glossaryid={$game->glossaryid}";
    $recs = $DB->get_records_sql( $sql);
    $a = array();
    foreach ($recs as $rec) {
        $a[] = $rec->concept;
    }

    game_check_common_problems_shortanswer_allowspaces( $game, $warnings, $a);
    if ($game->gamekind == 'hangman') {
        game_check_common_problems_shortanswer_hangman( $game, $warnings, $a);
    }
}

$game->glossaryid is always null and I saw that the fields were empty in tables: mdl_glossary mdl_glossary_alias mdl_glossary_categories mdl_glossary_entries ...