Hello everyone,
I want to get data of student's answers by $DB->get_records_sql(). My code is
SELECTI had tested in moodle database. It's true! But, when I use $DB->get_records_sql($sql), It's false. It's only viewed the last row of results. Please help me!
quiza.userid,
quiza.id AS quizattemptid,
quiza.attempt,
quiza.sumgrades,
qu.preferredbehaviour,
qa.slot,
qa.behaviour,
qa.questionid,
qa.variant,
qa.maxmark,
qa.minfraction,
qa.flagged,
qas.sequencenumber,
qas.state,
qas.fraction,
qasd.name,
qasd.VALUE,
qa.questionsummary,
qa.rightanswer,
qa.responsesummary
from mdl_quiz_attempts quiza
JOIN mdl_question_usages qu
ON qu.id = quiza.uniqueid
JOIN mdl_question_attempts qa
ON qa.questionusageid = qu.id
JOIN mdl_question_attempt_steps qas
ON qas.questionattemptid = qa.id
LEFT JOIN mdl_question_attempt_step_data qasd
ON qasd.attemptstepid = qas.id
WHERE quiza.quiz = '31' and qasd.name = '-finish' and quiza.userid = '25'
ORDER BY quiza.userid, quiza.attempt, qa.slot, qas.sequencenumber, qasd.name
Thank you very much!
And sorry for my bad English!