diff --git a/admin/statistics.php b/admin/statistics.php index 322d36582b0..8f2e3a2e760 100644 --- a/admin/statistics.php +++ b/admin/statistics.php @@ -671,7 +671,37 @@ { foreach($_POST['summary'] as $viewfields) { - echo "\t\t\t\n"; + switch(substr($viewfields, 0, 1)) + { + case "N": + case "T": + $field = substr($viewfields, 1, strlen($viewfields)-1); + echo "\t\t\t\n"; + break; + case "M": + list($lsid, $lgid, $lqid) = explode("X", substr($viewfields, 1, strlen($viewfields)-1)); + $aquery="SELECT code FROM {$dbprefix}answers WHERE qid=$lqid ORDER BY sortorder, answer"; + $aresult=mysql_query($aquery) or die ("Couldn't get answers
$aquery
".mysql_error()); + while ($arow=mysql_fetch_row($aresult)) // go through every possible answer + { + $field = substr($viewfields, 1, strlen($viewfields)-1).$arow[0]; + echo "\t\t\t\n"; + } + $aquery = "SELECT other FROM {$dbprefix}questions WHERE qid=$lqid"; + $aresult = mysql_query($aquery); + while($arow = mysql_fetch_row($aresult)){ + if ($arow[0] == "Y") { + echo $arow[0]; + $field = substr($viewfields, 1, strlen($viewfields)-1)."other"; + echo "\t\t\t\n"; + } + } // while + break; + default: + $field = $viewfields; + echo "\t\t\t\n"; + break; + } } } echo "\t\t\n\t\n";