From d733ecb92fa417f600a144c7cf87ed3b3b5bbdd1 Mon Sep 17 00:00:00 2001 From: azammitdcarf Date: Thu, 23 Jul 2009 04:38:40 +0000 Subject: [PATCH] Make sure data comes out in the right order --- functions/functions.limesurvey.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/functions/functions.limesurvey.php b/functions/functions.limesurvey.php index b152ac50..669f709d 100644 --- a/functions/functions.limesurvey.php +++ b/functions/functions.limesurvey.php @@ -464,11 +464,12 @@ function limesurvey_export_fixed_width($questionnaire_id,$sample_import_id = fal return; //foreach question - $sql = "SELECT * - FROM ".LIME_PREFIX."questions - WHERE sid=$surveyid - AND type NOT LIKE 'X' - ORDER BY gid,question_order ASC"; + $sql = "SELECT q.* + FROM ".LIME_PREFIX."questions as q, ".LIME_PREFIX."groups as g + WHERE q.sid=$surveyid + AND q.type NOT LIKE 'X' + AND g.gid = q.gid + ORDER BY g.group_order ASC,q.question_order ASC"; $r = $db->GetAll($sql); foreach ($r as $RowQ)