Hi All,
Testing a questionnaire submission to see if I get a notification email and on submission, I get "Error reading from database".
Activating debug shows the following when attempted again.
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 'rank
FROM wsu_moodle_cybersec_questionnaire_response qr
' at line 3
SELECT CONCAT_WS('_', qr.id, 'checkboxes', qrm.id) AS id,
qr.submitted, qr.complete, qr.grade, qr.userid, u.firstnamephonetic, u.lastnamephonetic, u.middlename, u.alternatename, u.firstname, u.lastname, u.username, u.department, u.institution, u.id as usrid, qr.id AS rid, qrm.question_id,
qrm.choice_id, qro.response AS response, 0 AS rank
FROM wsu_moodle_cybersec_questionnaire_response qr
JOIN wsu_moodle_cybersec_questionnaire_resp_multiple qrm ON qrm.response_id = qr.id
AND qr.survey_id = ? AND qr.complete = ?
LEFT JOIN wsu_moodle_cybersec_questionnaire_response_other qro ON qro.response_id = qr.id AND qro.choice_id = qrm.choice_id
LEFT JOIN wsu_moodle_cybersec_user u ON u.id = qr.userid
WHERE qr.id = ? UNION ALL
SELECT CONCAT_WS('_', qr.id, 'textbox', qrt.id) AS id,
qr.submitted, qr.complete, qr.grade, qr.userid, u.firstnamephonetic, u.lastnamephonetic, u.middlename, u.alternatename, u.firstname, u.lastname, u.username, u.department, u.institution, u.id as usrid, qr.id AS rid, qrt.question_id,
0 AS choice_id, qrt.response AS response, 0 AS rank
FROM wsu_moodle_cybersec_questionnaire_response qr
JOIN wsu_moodle_cybersec_questionnaire_response_text qrt
ON qrt.response_id = qr.id
AND qr.survey_id = ? AND qr.complete = ?
LEFT JOIN wsu_moodle_cybersec_user u ON u.id = qr.userid
WHERE qr.id = ? ORDER BY usrid, id
[array (
0 => '2',
1 => 'y',
2 => 3,
3 => '2',
4 => 'y',
5 => 3,
)]
Error code: dmlreadexception
Stack trace:
line 486 of /lib/dml/moodle_database.php: dml_read_exception thrown
line 1184 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
line 2597 of /mod/questionnaire/questionnaire.class.php: call to mysqli_native_moodle_database->get_recordset_sql()
line 2782 of /mod/questionnaire/questionnaire.class.php: call to questionnaire->get_survey_all_responses()
line 1902 of /mod/questionnaire/questionnaire.class.php: call to questionnaire->generate_csv()
line 1599 of /mod/questionnaire/questionnaire.class.php: call to questionnaire->response_send_email()
line 277 of /mod/questionnaire/questionnaire.class.php: call to questionnaire->submission_notify()
line 75 of /mod/questionnaire/complete.php: call to questionnaire->view()
Now my SQL is not the best but 0 AS rank? What's 0? Shouldn't that be a column name? Also didn't get a notification via email of this submission so I don't know if this error is blocking it or whether that's another issue altogether.
This server is
- Moodle 3.5.1+ (Build: 20180720)
- MySQL 8.0.12
- PHP 7.2.8.1.16.04.1.1
This server is also a live production server currently running a semester unit; appreciate a prompt response and resolution.
Thanks in Advance!
Cheers,
Ray.