From a3da021fe15b3888fb37e2987a1cd82d1c25232b Mon Sep 17 00:00:00 2001 From: Jason Cleeland Date: Fri, 8 Oct 2004 15:43:27 +0000 Subject: [PATCH] bugfix: extrapolates full fieldnames for multiple option when passing selected columns to export.php git-svn-id: file:///Users/Shitiz/Downloads/lssvn/trunk/unstable@1236 b72ed6b6-b9f8-46b5-92b4-906544132732 --- admin/statistics.php | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) 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";