From: stronk7 Date: Fri, 10 Aug 2007 01:46:17 +0000 (+0000) Subject: Fixing one SQL that could cause problems with coincidences X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=87f47bec9490581cfc3262cf4b55505f41ca4c84;p=moodle.git Fixing one SQL that could cause problems with coincidences in the associative array. MDL-10787 Merged from MOODLE_18_STABLE --- diff --git a/mod/survey/lib.php b/mod/survey/lib.php index 26e3a54965..b7a491f0f4 100644 --- a/mod/survey/lib.php +++ b/mod/survey/lib.php @@ -224,14 +224,13 @@ function survey_get_responses($surveyid, $groupid) { $groupsql = ""; } - return get_records_sql("SELECT MAX(a.time) as time, - u.id, u.firstname, u.lastname, u.picture - FROM {$CFG->prefix}survey_answers a, - {$CFG->prefix}user u $groupsdb - WHERE a.survey = $surveyid - AND a.userid = u.id $groupsql - GROUP BY u.id, u.firstname, u.lastname, u.picture - ORDER BY time ASC"); + return get_records_sql("SELECT u.id, u.firstname, u.lastname, u.picture, MAX(a.time) as time + FROM {$CFG->prefix}survey_answers a, + {$CFG->prefix}user u $groupsdb + WHERE a.survey = $surveyid + AND a.userid = u.id $groupsql + GROUP BY u.id, u.firstname, u.lastname, u.picture + ORDER BY time ASC"); } function survey_get_analysis($survey, $user) {