Skip to content

Commit

Permalink
Added error handling for surveys containing 0 responses (stop divide …
Browse files Browse the repository at this point in the history
…by 0 error). Added "SQL: " in front of sql code. Changed 'No surveys' to 'N/A' in summary section.

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/trunk/unstable@196 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
jcleeland committed Apr 5, 2003
1 parent d661e64 commit 4c1f4a4
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions admin/statistics.php
Expand Up @@ -355,10 +355,15 @@
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' 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("%01.2f", ($results/$total)*100);
echo "$percent% of your total results<br />\n\t\t<br />\n";
echo "\t\t<font size='1'>$query\n";
echo "There are $total records in your survey.";
if ($total)
{
echo " This query represents ";
$percent=sprintf("%01.2f", ($results/$total)*100);
echo "$percent% of your total results<br />";
}
echo "\n\t\t<br />\n";
echo "\t\t<font size='1'><b>SQL:</b> $query\n";
echo "\t</td></tr>\n";
if ($selects) {$sql=implode(" AND ", $selects);}
if ($results > 0)
Expand Down Expand Up @@ -502,8 +507,8 @@
if ($al[0] == "") {$fname="No Answer";} else {$fname="$al[1] ($al[0])";}
echo "\t<tr>\n\t\t<td width='50%' align='center' 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]";
if ($results > 0) {$vp=sprintf("%01.2f", ($row[0]/$results)*100);} else {$vp="No Records";}
echo "\t\t</td><td width='25%' align='center' bgcolor='#666666'>$setfont<font color='#EEEEEE'>$vp%";
if ($results > 0) {$vp=sprintf("%01.2f", ($row[0]/$results)*100)."%";} else {$vp="N/A";}
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 4c1f4a4

Please sign in to comment.