From ee22a54bf773690602e572529fa26c30917ba5c2 Mon Sep 17 00:00:00 2001 From: Florent Bruneau Date: Sat, 14 Aug 2010 10:44:29 +0200 Subject: [PATCH] Some votes entries are not associated with an anwser. Because of the way votes are written in the database, an entry of survey_votes can be associated with 0 survey_answers entries. Using a LEFT JOIN in this case is buggy because it generates NULL entries that are not supported by the processing code. Closes #1214 Signed-off-by: Florent Bruneau --- modules/survey/survey.inc.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/survey/survey.inc.php b/modules/survey/survey.inc.php index b416b28..0c0c645 100644 --- a/modules/survey/survey.inc.php +++ b/modules/survey/survey.inc.php @@ -200,10 +200,9 @@ class Survey } $sql = 'SELECT v.id AS vid, a.question_id AS qid, a.answer AS answer FROM survey_votes AS v - LEFT JOIN survey_answers AS a - ON a.vote_id=v.id + INNER JOIN survey_answers AS a ON a.vote_id=v.id WHERE v.survey_id={?} - ORDER BY vid ASC, qid ASC, answer ASC;'; + ORDER BY vid ASC, qid ASC, answer ASC'; $res = XDB::iterator($sql, $this->id); // retrieves all answers from database $vid = -1; $vid_ = 0; -- 2.1.4