Skip to content

Commit

Permalink
Added perecentage to summary results, and column headings
Browse files Browse the repository at this point in the history
git-svn-id: file:///Users/Shitiz/Downloads/lssvn/trunk/unstable@45 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
jcleeland committed Mar 16, 2003
1 parent fb67fa7 commit b37a371
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions admin/statistics.php
Expand Up @@ -303,9 +303,9 @@
while ($row=mysql_fetch_row($result)) {$results=$row[0];}

// 3: Present results including option to view those rows
echo "<br />\n<table align='center' width='95%' border='1' bgcolor='#444444' cellpadding='0' cellspacing='0' bordercolor='black'>\n";
echo "<br />\n<table align='center' width='95%' border='1' bgcolor='#444444' cellpadding='2' cellspacing='0' bordercolor='black'>\n";
echo "\t<tr><td colspan='2' align='center'><b>$setfont<font color='orange'>Results:</b></td></tr>\n";
echo "\t<tr><td colspan='2' align='center'>$setfont<font color='#EEEEEE'>";
echo "\t<tr><td colspan='2' align='center' bgcolor='#666666'>$setfont<font color='#EEEEEE'>";
echo "<B>Your query returns $results record(s)!</b><br />\n\t\t";
echo "There are $total records in your survey. This query represents ";
$percent=sprintf("%02d", ($results/$total)*100);
Expand Down Expand Up @@ -341,8 +341,12 @@
$fvalues[]=$row[0];
}
//foreach ($fvalues as $fv) {echo "$fv | ";} //debugging line
echo "<br />\n<table align='center' width='95%' border='1' bgcolor='#444444' cellpadding='0' cellspacing='0' bordercolor='black'>\n";
echo "\t<tr><td colspan='2' align='center'><b>$setfont<font color='orange'>Field Summary for {$_POST['summary']}:</b></td></tr>\n";
echo "<br />\n<table align='center' width='95%' border='1' bgcolor='#444444' cellpadding='2' cellspacing='0' bordercolor='black'>\n";
echo "\t<tr><td colspan='3' align='center'><b>$setfont<font color='orange'>Field Summary for {$_POST['summary']}:</b></td></tr>\n";
echo "\t<tr>\n\t\t<td width='50%' align='right' bgcolor='#666666'>$setfont<font color='#EEEEEE'><b>Answer</b></font></td>\n";
echo "\t\t<td width='25%' align='center' bgcolor='#666666'>$setfont<font color='#EEEEEE'><b>Count</b></font></td>\n";
echo "\t\t<td width='25%' align='center' bgcolor='#666666'>$setfont<font color='#EEEEEE'><b>Percentage</b></font></td>\n";
echo "\t</tr>\n";
foreach ($fvalues as $fv)
{
$query = "SELECT count({$_POST['summary']}) FROM survey_$sid WHERE {$_POST['summary']} = '$fv'";
Expand All @@ -351,8 +355,10 @@
while ($row=mysql_fetch_row($result))
{
if ($fv == "") {$fname="No Answer";} else {$fname=$fv;}
echo "\t<tr>\n\t\t<td width='50%' align='right'>$setfont<font color='#EEEEEE'>$fname:\n\t\t</td>\n";
echo "\t\t<td width='50%'>$setfont<font color='#EEEEEE'>$row[0]";
echo "\t<tr>\n\t\t<td width='50%' align='right' bgcolor='#666666'>$setfont<font color='#EEEEEE'>$fname:\n\t\t</td>\n";
echo "\t\t<td width='25%' align='center' bgcolor='#666666'>$setfont<font color='#EEEEEE'>$row[0]";
$vp=sprintf("%02d", ($row[0]/$results)*100);
echo "\t\t</td><td width='25%' align='center' bgcolor='#666666'>$setfont<font color='#EEEEEE'>$vp%";
echo "\t\t</td></tr>\n";
}
}
Expand Down

0 comments on commit b37a371

Please sign in to comment.