Skip to content

Commit

Permalink
Fixed ordering of answers. Some were ordered by code, but should alwa…
Browse files Browse the repository at this point in the history
…ys be ordered by question text.

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/trunk/unstable@319 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
jcleeland committed Jun 1, 2003
1 parent 87619fc commit 3043571
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 24 deletions.
6 changes: 3 additions & 3 deletions admin/activate.php
Expand Up @@ -48,7 +48,7 @@
$chkresult = mysql_query($chkquery) or die ("Couldn't get list of questions<br />$chkquery<br />".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)
Expand Down Expand Up @@ -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<br />$abquery<br />".mysql_error());
while ($abrow=mysql_fetch_array($abresult))
{
Expand All @@ -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<br />$abquery<br />".mysql_error());
$abcount=mysql_num_rows($abresult);
for ($i=1; $i<=$abcount; $i++)
Expand Down
8 changes: 4 additions & 4 deletions admin/browse.php
Expand Up @@ -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))
{
Expand All @@ -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++)
Expand Down Expand Up @@ -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++)
Expand All @@ -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))
Expand Down
30 changes: 15 additions & 15 deletions admin/dataentry.php
Expand Up @@ -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++)
Expand All @@ -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))
{
Expand Down Expand Up @@ -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))
{
Expand All @@ -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++)
Expand Down Expand Up @@ -367,7 +367,7 @@
echo "\t\t\t<select>\n";
break;
case "L": //LIST drop-down/radio-button list
$lquery = "SELECT * FROM answers WHERE qid={$fnames[$i][7]} ORDER BY code";
$lquery = "SELECT * FROM answers WHERE qid={$fnames[$i][7]} ORDER BY answer";
$lresult = mysql_query($lquery);
echo "\t\t\t<select name='{$fnames[$i][0]}'>\n";
echo "\t\t\t\t<option value=''";
Expand All @@ -383,7 +383,7 @@
echo "\t\t\t</select>\n";
break;
case "O": //LIST WITH COMMENT drop-down/radio-button list + textarea
$lquery = "SELECT * FROM answers WHERE qid={$fnames[$i][7]} ORDER BY code";
$lquery = "SELECT * FROM answers WHERE qid={$fnames[$i][7]} ORDER BY answer";
$lresult = mysql_query($lquery);
echo "\t\t\t<select name='{$fnames[$i][0]}'>\n";
echo "\t\t\t\t<option value=''";
Expand Down Expand Up @@ -414,7 +414,7 @@
}
$i++;
}
$ansquery = "SELECT * FROM answers WHERE qid={$fnames[$l][7]} ORDER BY code";
$ansquery = "SELECT * FROM answers WHERE qid={$fnames[$l][7]} ORDER BY answer";
$ansresult = mysql_query($ansquery);
$anscount = mysql_num_rows($ansresult);
echo "\t\t\t<script type='text/javascript'>\n";
Expand Down Expand Up @@ -779,7 +779,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 ($x=1; $x<=$i2count; $x++)
Expand All @@ -802,7 +802,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";
//echo $i2query;
$i2result = mysql_query($i2query);
$otherexists = "";
Expand Down Expand Up @@ -1064,7 +1064,7 @@
echo "comment'>$idrow[$i]</textarea>\n";
break;
case "R": //RANKING TYPE QUESTION
$ansquery = "SELECT * FROM answers WHERE qid={$deqrow['qid']} ORDER BY code";
$ansquery = "SELECT * FROM answers WHERE qid={$deqrow['qid']} ORDER BY answer";
$ansresult = mysql_query($ansquery);
$anscount = mysql_num_rows($ansresult);
echo "\t\t\t<script type='text/javascript'>\n";
Expand Down Expand Up @@ -1209,7 +1209,7 @@

break;
case "M": //MULTIPLE OPTIONS checkbox (Quite tricky really!)
$meaquery = "SELECT * FROM answers WHERE qid={$deqrow['qid']} ORDER BY code";
$meaquery = "SELECT * FROM answers WHERE qid={$deqrow['qid']} ORDER BY answer";
$mearesult = mysql_query($meaquery);
while ($mearow = mysql_fetch_array($mearesult))
{
Expand All @@ -1225,7 +1225,7 @@
break;
case "P": //MULTIPLE OPTIONS WITH COMMENTS checkbox + text
echo "<table border='0'>\n";
$meaquery = "SELECT * FROM answers WHERE qid={$deqrow['qid']} ORDER BY code";
$meaquery = "SELECT * FROM answers WHERE qid={$deqrow['qid']} ORDER BY answer";
$mearesult = mysql_query($meaquery);
while ($mearow = mysql_fetch_array($mearesult))
{
Expand Down Expand Up @@ -1270,7 +1270,7 @@
echo "\t\t\t</select>\n";
break;
case "A": //ARRAY (5 POINT CHOICE) radio-buttons
$meaquery = "SELECT * FROM answers WHERE qid={$deqrow['qid']} ORDER BY code";
$meaquery = "SELECT * FROM answers WHERE qid={$deqrow['qid']} ORDER BY answer";
$mearesult = mysql_query($meaquery);
echo "<table>\n";
while ($mearow = mysql_fetch_array($mearesult))
Expand All @@ -1294,7 +1294,7 @@
echo "</table>\n";
break;
case "B": //ARRAY (10 POINT CHOICE) radio-buttons
$meaquery = "SELECT * FROM answers WHERE qid={$deqrow['qid']} ORDER BY code";
$meaquery = "SELECT * FROM answers WHERE qid={$deqrow['qid']} ORDER BY answer";
$mearesult = mysql_query($meaquery);
echo "<table>\n";
while ($mearow = mysql_fetch_array($mearesult))
Expand All @@ -1318,7 +1318,7 @@
echo "</table>\n";
break;
case "C": //ARRAY (YES/UNCERTAIN/NO) radio-buttons
$meaquery = "SELECT * FROM answers WHERE qid={$deqrow['qid']} ORDER BY code";
$meaquery = "SELECT * FROM answers WHERE qid={$deqrow['qid']} ORDER BY answers";
$mearesult=mysql_query($meaquery);
echo "<table>\n";
while ($mearow = mysql_fetch_array($mearesult))
Expand Down
2 changes: 1 addition & 1 deletion admin/html.php
Expand Up @@ -176,7 +176,7 @@
$questionsummary .= "\t<tr><td align='right' valign='top'>$setfont<b>Help:</b></font></td>\n\t<td>$setfont{$qrrow['help']}</td></tr>\n";
$qtypes = getqtypelist("", "array"); //qtypes = array(type code=>type description)
$questionsummary .= "\t<tr><td align='right' valign='top'>$setfont<b>Type:</b></font></td>\n\t<td>$setfont{$qtypes[$qrrow['type']]}</td></tr>\n";
$qrq = "SELECT * FROM answers WHERE qid=$qid";
$qrq = "SELECT * FROM answers WHERE qid=$qid ORDER BY answer";
$qrr = mysql_query($qrq);
$qct = mysql_num_rows($qrr);
if ($qrrow['type'] == "O" || $qrrow['type'] == "L" || $qrrow['type'] == "M" || $qrrow['type'] == "A" || $qrrow['type'] == "B" || $qrrow['type'] == "C" || $qrrow['type'] == "P" || $qrrow['type'] == "R")
Expand Down
2 changes: 1 addition & 1 deletion admin/printablesurvey.php
Expand Up @@ -214,7 +214,7 @@
echo "\t\t\t<textarea $boxstyle cols='50' rows='8' name='$fieldname"."comment"."'></textarea>\n";
break;
case "R": //RANKING Type Question
$reaquery = "SELECT * FROM answers WHERE qid={$deqrow['qid']} ORDER BY code";
$reaquery = "SELECT * FROM answers WHERE qid={$deqrow['qid']} ORDER BY answer";
$rearesult = mysql_query($reaquery) or die ("Couldn't get ranked answers<br />".mysql_error());
$reacount = mysql_num_rows($rearesult);
echo "\t\t\t$setfont<u>Please number each box in order of preference from 1 to $reacount</u><br />\n";
Expand Down

0 comments on commit 3043571

Please sign in to comment.