wahlhelfer/statistics/question-report.php

100 lines
3.5 KiB
PHP
Raw Normal View History

2014-05-15 16:49:45 +00:00
<?php
include('../config/config.php');
include(STATE_HTML.'html.inc.php');
include(STATE_INCLUDES.'functions.php');
checkLoginAdmin();
startHtml($title = "Questions Responses");
tophead($title);
leftNav();
?>
<section id="main" class="column">
<article class="module width_full">
<header>
<h3 class="tabs_involved">Questions Response Statistics</h3>
</header>
<table class="display data-table" id="myTable">
<thead>
<tr>
<th width="50">Position</th>
<th width="200">Issue Title</th>
<th>Question</th>
<th>Agree</th>
<th>Neutral</th>
<th>Disagree</th>
<th>Skip</th>
<th width="120">Total Responses</th>
</tr>
</thead>
<tbody>
<?php
$getRes = mysql_query("SELECT Id, Heading, Question FROM tbl_questions ORDER BY Id DESC");
$count = 1;
while( $row = mysql_fetch_array($getRes) )
{
?>
<tr>
<td align="center"><?php echo $count;?></td>
<td align="center"><?php echo $row['Heading'];?></td>
<td align="left"><?php echo nl2br($row['Question']);?></td>
<?php
$qry="SELECT COUNT(tbl_question_answer.Id) AS Total
FROM tbl_question_answer
WHERE tbl_question_answer.QuestionId='".$row['Id']."' AND tbl_question_answer.Answer='A'";
$res=mysql_query($qry);
$rec=mysql_fetch_array($res);
?>
<td align="center"><?php echo $rec['Total']; ?></td>
<?php
$qry="SELECT COUNT(tbl_question_answer.Id) AS Total
FROM tbl_question_answer
WHERE tbl_question_answer.QuestionId='".$row['Id']."' AND tbl_question_answer.Answer='D'";
$res=mysql_query($qry);
$rec=mysql_fetch_array($res);
?>
<td align="center"><?php echo $rec['Total'];?></td>
<?php
$qry="SELECT COUNT(tbl_question_answer.Id) AS Total
FROM tbl_question_answer
WHERE tbl_question_answer.QuestionId='".$row['Id']."' AND tbl_question_answer.Answer='N'";
$res=mysql_query($qry);
$rec=mysql_fetch_array($res);
?>
<td align="center"><?php echo $rec['Total'];?></td>
<?php
$qry="SELECT COUNT(tbl_question_answer.Id) AS Total
FROM tbl_question_answer
WHERE tbl_question_answer.QuestionId='".$row['Id']."' AND tbl_question_answer.Answer='S'";
$res=mysql_query($qry);
$rec=mysql_fetch_array($res);
?>
<td align="center"><?php echo $rec['Total'];?></td>
<td align="center">
<?php
$qry="SELECT COUNT(tbl_question_answer.Id) AS Total
FROM tbl_question_answer
WHERE tbl_question_answer.QuestionId='".$row['Id']."' AND tbl_question_answer.Answer!='S'";
$res=mysql_query($qry);
$rec=mysql_fetch_array($res);
?>
<span style="font-size:16px; font-weight:bold;"><?php echo $rec['Total']; ?></span>
</td>
</tr>
<?php
$count++;
}
?>
</tbody>
</table>
</article>
<div class="spacer"></div>
</section>
<?php
endHtml();
?>