Just for a little more background information about when this error is occurring:
- The course (and activity) is set up with separate groups.
- Individual users are each added to a group and have no problems viewing and responding to the questions in the questionnaire.
- The course teacher is NOT added to any of the groups.
- The course teacher, when first clicking the questionnaire activity, sees a tab indicating there are 6 results to view.
- Clicking that tab generates the error, along with the message saying, "Sorry, you must be member of at least one group that is used in this activity..
- As a site administrator - I also receive the same message and am unable to see any responses to the questionnaire.
Here's the debugging message:
Debug info: You have an error in your
SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near 'INT))=GM.userid
ORDER BY R.id' at line 7
SELECT R.id, R.survey_id
FROM mdl_questionnaire_response R,
mdl_groups_members GM
WHERE R.survey_id='1' AND
R.complete='y' AND
GM.groupid=0 AND
(CAST (R.username as INT))=GM.userid
ORDER BY R.id
[array (
)]
Stack trace:
- line 394 of \lib\dml\moodle_database.php: dml_read_exception thrown
- line 794 of \lib\dml\mysqli_native_moodle_database.php: call to moodle_database->query_end()
- line 2272 of \mod\questionnaire\locallib.php: call to mysqli_native_moodle_database->get_records_sql()
- line 626 of \mod\questionnaire\report.php: call to questionnaire->survey_results()