Created
October 26, 2014 17:33
-
-
Save mkhuda/9f30fb17a6d439aa5d35 to your computer and use it in GitHub Desktop.
kuesioner-dynamic.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
session_start(); | |
if (isset($_SESSION['level'])) | |
{ | |
if ($_SESSION['level'] == "admin") | |
{ | |
} | |
else if ($_SESSION['level'] == "user") | |
{ | |
header('location:../index.php'); | |
} | |
} | |
if (!isset($_SESSION['level'])) | |
{ | |
header('location:../index.php'); | |
} | |
if (isset ($_GET['kode'])) { | |
$chart = 'kues_1'; | |
?> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<script type="text/javascript" src="../jquery-1.8.3.js"></script> | |
<link href="../css/bootstrap.css" rel="stylesheet" media="screen"> | |
<link href="../js/bootstrap.js" rel="stylesheet" media="screen"> | |
</head> | |
<body> | |
<center><h1>Hasil Voting</h1></center> | |
<div id="jumlah"> | |
<?php | |
include 'config.php'; | |
$querytotal = mysql_query('select * from user'); | |
$pemilihaktif = mysql_query('select * from user where indikator = 1'); | |
$pemilihpasif = mysql_query('select * from user where indikator = 0'); | |
$rowpemilihaktif = mysql_num_rows($pemilihaktif); | |
$rowpemilihpasif = mysql_num_rows($pemilihpasif); | |
$rowtotal = mysql_num_rows($querytotal); | |
// Query total voting per orang | |
$stp = "select * from kuesioner where kuesioner.$chart=0"; | |
$stpquery = mysql_query($stp); | |
$stptotal = mysql_num_rows($stpquery); | |
$tp = "select * from kuesioner where kuesioner.$chart=1"; | |
$tpquery = mysql_query($tp); | |
$tptotal = mysql_num_rows($tpquery); | |
$cp = "select * from kuesioner where kuesioner.$chart=2"; | |
$cpquery = mysql_query($cp); | |
$cptotal = mysql_num_rows($cpquery); | |
$p = "select * from kuesioner where kuesioner.$chart=3"; | |
$pquery = mysql_query($p); | |
$ptotal = mysql_num_rows($pquery); | |
$sp = "select * from kuesioner where kuesioner.$chart=4"; | |
$spquery = mysql_query($sp); | |
$sptotal = mysql_num_rows($spquery); | |
?> | |
<table class="table" width="100%"> | |
<tbody> | |
<tr class="title"> | |
<td><strong>No</strong></td> | |
<td><strong>Nama</strong></td> | |
<td><strong>Total Pemilih</strong></td> | |
</tr> | |
<tr> | |
<td><strong>1</strong></td> | |
<td>Kandidat A</td> | |
<td><strong><?php echo $stptotal; ?></strong></td> | |
</tr> | |
<tr> | |
<td><strong>2</strong></td> | |
<td>Kandidat B</td> | |
<td><strong><?php echo $tptotal; ?></strong></td> | |
</tr> | |
<tr> | |
<td><strong>3</strong></td> | |
<td>Kandidat C</td> | |
<td><strong><?php echo $cptotal; ?></strong></td> | |
</tr> | |
<tr> | |
<td><strong>4</strong></td> | |
<td>Kandidat D</td> | |
<td><strong><?php echo $ptotal; ?></strong></td> | |
</tr> | |
<tr> | |
<td><strong>5</strong></td> | |
<td>Kandidat E</td> | |
<td><strong><?php echo $sptotal; ?></strong></td> | |
</tr> | |
</tbody> | |
</table> | |
<h5>Jumlah Pemilih <?php echo $data['jenis']; ?> adalah <b><?php echo $rowtotal; ?></b></h5> | |
<h5>Jumlah Yang Sudah Melakukan Voting <?php echo $data['jenis']; ?> adalah <b><?php echo $rowpemilihaktif; ?></b></h5> | |
<h5>Jumlah Yang Tidak Melakukan Voting <?php echo $data['jenis']; ?> adalah <b><?php echo $rowpemilihpasif; ?></b></h5> | |
</div> | |
</body> | |
</html> | |
<?php | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment