From 30435712c1544904701be8a45657c1f5911b11ee Mon Sep 17 00:00:00 2001 From: Jason Cleeland Date: Sun, 1 Jun 2003 12:19:13 +0000 Subject: [PATCH] Fixed ordering of answers. Some were ordered by code, but should always be ordered by question text. git-svn-id: file:///Users/Shitiz/Downloads/lssvn/trunk/unstable@319 b72ed6b6-b9f8-46b5-92b4-906544132732 --- admin/activate.php | 6 +++--- admin/browse.php | 8 ++++---- admin/dataentry.php | 30 +++++++++++++++--------------- admin/html.php | 2 +- admin/printablesurvey.php | 2 +- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/admin/activate.php b/admin/activate.php index 091a74073c6..157c63a2b7f 100644 --- a/admin/activate.php +++ b/admin/activate.php @@ -48,7 +48,7 @@ $chkresult = mysql_query($chkquery) or die ("Couldn't get list of questions
$chkquery
".mysql_error()); while ($chkrow = mysql_fetch_array($chkresult)) { - $chaquery = "SELECT * FROM answers WHERE qid = {$chkrow['qid']}"; + $chaquery = "SELECT * FROM answers WHERE qid = {$chkrow['qid']} ORDER BY answer"; $charesult=mysql_query($chaquery); $chacount=mysql_num_rows($charesult); if (!$chacount > 0) @@ -233,7 +233,7 @@ elseif ($arow['type'] == "M" || $arow['type'] == "A" || $arow['type'] == "B" || $arow['type'] == "C" || $arow['type'] == "P") { //MULTI ENTRY - $abquery = "SELECT answers.*, questions.other FROM answers, questions WHERE answers.qid=questions.qid AND sid={$_GET['sid']} AND questions.qid={$arow['qid']} ORDER BY code"; + $abquery = "SELECT answers.*, questions.other FROM answers, questions WHERE answers.qid=questions.qid AND sid={$_GET['sid']} AND questions.qid={$arow['qid']} ORDER BY answers.answer"; $abresult=mysql_query($abquery) or die ("Couldn't get perform answers query
$abquery
".mysql_error()); while ($abrow=mysql_fetch_array($abresult)) { @@ -256,7 +256,7 @@ elseif ($arow['type'] == "R") { //MULTI ENTRY - $abquery = "SELECT answers.*, questions.other FROM answers, questions WHERE answers.qid=questions.qid AND sid={$_GET['sid']} AND questions.qid={$arow['qid']} ORDER BY code"; + $abquery = "SELECT answers.*, questions.other FROM answers, questions WHERE answers.qid=questions.qid AND sid={$_GET['sid']} AND questions.qid={$arow['qid']} ORDER BY answers.answer"; $abresult=mysql_query($abquery) or die ("Couldn't get perform answers query
$abquery
".mysql_error()); $abcount=mysql_num_rows($abresult); for ($i=1; $i<=$abcount; $i++) diff --git a/admin/browse.php b/admin/browse.php index 3ba3f1b6cf1..ed65a2730aa 100644 --- a/admin/browse.php +++ b/admin/browse.php @@ -142,7 +142,7 @@ $fquestion = $fnrow['question']; if ($fnrow['type'] == "M" || $fnrow['type'] == "A" || $fnrow['type'] == "B" || $fnrow['type'] == "C" || $fnrow['type'] == "P") { - $fnrquery = "SELECT * FROM answers WHERE qid={$fnrow['qid']} ORDER BY code"; + $fnrquery = "SELECT * FROM answers WHERE qid={$fnrow['qid']} ORDER BY answer"; $fnrresult = mysql_query($fnrquery); while ($fnrrow = mysql_fetch_array($fnrresult)) { @@ -156,7 +156,7 @@ } elseif ($fnrow['type'] == "R") { - $fnrquery = "SELECT * FROM answers WHERE qid={$fnrow['qid']} ORDER BY code"; + $fnrquery = "SELECT * FROM answers WHERE qid={$fnrow['qid']} ORDER BY answer"; $fnrresult = mysql_query($fnrquery); $fnrcount = mysql_num_rows($fnrresult); for ($i=1; $i<=$fnrcount; $i++) @@ -283,7 +283,7 @@ } elseif ($fnrow['type'] == "R") { - $i2query = "SELECT answers.*, questions.other FROM answers, questions WHERE answers.qid=questions.qid AND questions.qid={$fnrow['qid']} AND questions.sid=$sid ORDER BY code"; + $i2query = "SELECT answers.*, questions.other FROM answers, questions WHERE answers.qid=questions.qid AND questions.qid={$fnrow['qid']} AND questions.sid=$sid ORDER BY answers.answer"; $i2result = mysql_query($i2query); $i2count = mysql_num_rows($i2result); for ($i=1; $i<=$i2count; $i++) @@ -295,7 +295,7 @@ } else { - $i2query = "SELECT answers.*, questions.other FROM answers, questions WHERE answers.qid=questions.qid AND questions.qid={$fnrow['qid']} AND questions.sid=$sid ORDER BY code"; + $i2query = "SELECT answers.*, questions.other FROM answers, questions WHERE answers.qid=questions.qid AND questions.qid={$fnrow['qid']} AND questions.sid=$sid ORDER BY answers.answer"; $i2result = mysql_query($i2query); $otherexists = ""; while ($i2row = mysql_fetch_array($i2result)) diff --git a/admin/dataentry.php b/admin/dataentry.php index 7e44dbf5ff8..ec820f64aa4 100644 --- a/admin/dataentry.php +++ b/admin/dataentry.php @@ -110,7 +110,7 @@ } elseif ($irow['type'] == "R") { - $i2query = "SELECT answers.*, questions.other FROM answers, questions WHERE answers.qid=questions.qid AND questions.qid={$irow['qid']} AND questions.sid=$sid ORDER BY code"; + $i2query = "SELECT answers.*, questions.other FROM answers, questions WHERE answers.qid=questions.qid AND questions.qid={$irow['qid']} AND questions.sid=$sid ORDER BY answers.answer"; $i2result = mysql_query($i2query); $i2count = mysql_num_rows($i2result); for ($i=1; $i<=$i2count; $i++) @@ -134,7 +134,7 @@ } else { - $i2query = "SELECT answers.*, questions.other FROM answers, questions WHERE answers.qid=questions.qid AND questions.qid={$irow['qid']} AND questions.sid=$sid ORDER BY code"; + $i2query = "SELECT answers.*, questions.other FROM answers, questions WHERE answers.qid=questions.qid AND questions.qid={$irow['qid']} AND questions.sid=$sid ORDER BY answers.answer"; $i2result = mysql_query($i2query); while ($i2row = mysql_fetch_array($i2result)) { @@ -258,7 +258,7 @@ $fquestion = $fnrow['question']; if ($fnrow['type'] == "M" || $fnrow['type'] == "A" || $fnrow['type'] == "B" || $fnrow['type'] == "C" || $fnrow['type'] == "P") { - $fnrquery = "SELECT * FROM answers WHERE qid={$fnrow['qid']} ORDER BY code"; + $fnrquery = "SELECT * FROM answers WHERE qid={$fnrow['qid']} ORDER BY answer"; $fnrresult = mysql_query($fnrquery); while ($fnrrow = mysql_fetch_array($fnrresult)) { @@ -279,7 +279,7 @@ } elseif ($fnrow['type'] == "R") { - $fnrquery = "SELECT * FROM answers WHERE qid={$fnrow['qid']} ORDER BY code"; + $fnrquery = "SELECT * FROM answers WHERE qid={$fnrow['qid']} ORDER BY answer"; $fnrresult = mysql_query($fnrquery); $fnrcount = mysql_num_rows($fnrresult); for ($j=1; $j<=$fnrcount; $j++) @@ -367,7 +367,7 @@ echo "\t\t\t\n"; echo "\t\t\t\t