	<?php session_start();
	ini_set('display_errors', 1);
	ini_set('display_startup_errors', 1);
	error_reporting(E_ALL);
	//$_SESSION['loggedinuser'];
	//$loggedinuser=$_SESSION['loggedinuser'];
	//check if the user is logged in
	if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] == true) {
	} else {
	header('Location: index.php');
	}
	date_default_timezone_set("Africa/Nairobi");
	?>
	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us">
	<head>
	<link rel="icon" href="../images/favicon.png">
	<title>Deadly Force::People killed by the police in Kenya</title>
	<!-- Bootstrap core CSS -->
	<link href="../css/bootstrap.css" rel="stylesheet">
	<link href="../css/zebra_datepicker_metallic.css" rel="stylesheet">
	<!-- Bootstrap theme -->
	<link href="../css/bootswatch_min.css" rel="stylesheet">

	<!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
	<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
	<script src="../../assets/js/ie-emulation-modes-warning.js"></script>

	<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
	<!--[if lt IE 9]>
	<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
	<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
	<![endif]-->
	
	<link rel="stylesheet" href="../css/table_sorter_style.css" type="text/css" id="" media="print, projection, screen" />
	<script type="text/javascript" src="../js/jquery-latest.js"></script>
	<script type="text/javascript" src="../js/jquery.tablesorter.js"></script>
	<script type="text/javascript" src="../js/jquery.tablesorter.pager.js"></script>
	<script src="../js/bootstrap.min.js"></script>
	<script src="../js/bootstrapValidator.js"></script>
	<script src="../js/bootswatch.js"></script>
	<script src="../js/docs.min.js"></script>

	<script>
	$(document).ready(function() {
	$("table")
	.tablesorter({sortList:[[4,1]],widgets: ['zebra'],
	headers: {
	2: {sorter: false},
	3: {sorter: false},
	5: {sorter: false},
	6: {sorter: false},
	8: {sorter: false},
	9: {sorter: false},
	10: {sorter: false},
	}
	})
	.tablesorterPager({container: $("#pager")});
	});
	</script>
	</head>
	<body>
	<!-- Fixed navbar -->
	<div class="navbar navbar-default navbar-fixed-top" role="navigation">
	<div class="container">
	<div class="navbar-header">
	<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
	<span class="sr-only">Toggle navigation</span>
	<span class="icon-bar"></span>
	<span class="icon-bar"></span>
	<span class="icon-bar"></span>
	</button>
	<a class="navbar-brand" href="index.php">
	<img src="../images/newsplex_logo.png" width="145" height="70" alt="nation newsplex"/>
	<div class="header-slogan">
	<span class="big-slogan">Deadly force</span><br>
	<span class="slogan">People killed by the police in Kenya</span>
	</div>
	</a>
	</div>
	<div class="navbar-collapse collapse">
	<ul class="nav navbar-nav">
	<li><a href="../tip.php">Submit tip</a></li>
	<li><a href="../index.php#database">Database</a></li>
	<li><a href="../about.php">About</a></li>
	<li><a href="../articles.php">Read articles</a></li>
	</ul>
	</li>
	</ul>
	</div><!--/.nav-collapse -->
	</div>
	</div>
	<div class="container main">
	<p><h1>View victims details &raquo;</h1></p>
	<div id="detailstable">
	<table cellspacing="1" class="tablesorter">
	<thead>
	<tr>
	<th>Victim name</th>
	<th>Gender</th>
	<th>Age </th>
	<th>Occupation</th>
	<th>Date of incident</th>
	<th>County</th>
	<th>Officer(s) identified</th>
	<th>Victim armed</th>
	<th>Police weapon</th>
	<th>OB no</th>
	<th>Case status</th>
	</tr>
	</thead>
	<tbody>
	<?php
	$servername = "localhost";
	$dbuser = "root";
	$dbpass = "root";
	$dbname = "deadly_force";
	try {
	$conn = new PDO("mysql:host=$servername;dbname=$dbname", $dbuser, $dbpass);
	// set the PDO error mode to exception
	$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
	//check if victim name exists in the database
	$sthandler = $conn->prepare("select * from police_killings");
	$sthandler->execute();
	$victims = $sthandler->fetchAll();
    foreach ($victims as $row) {
	echo "<tr>";
	echo "<td>" ."<a href='editvictimdetails.php?entryno=$row[0]'>" .$row['victim_names'] . "</a>"."</td>";
	echo "<td>" . $row['victim_gender'] . "</td>";
	echo "<td>" . $row['victim_age'] . "</td>";
	echo "<td>" . $row['victim_occupation'] . "</td>";
	echo "<td>" . $row['date_of_incident'] . "</td>";
	echo "<td>" . $row['incident_county_or_town'] . "</td>";
	echo "<td>" . $row['officer_involved'] . "</td>";
	echo "<td>" . $row['victim_armed_unarmed'] . "</td>";
	echo "<td>" . $row['police_weapon'] . "</td>";
	echo "<td>" . $row['entry_in_occurence_book'] . "</td>";
	echo "<td>" . $row['status_of_case'] . "</td>";
	echo "</tr>";
    //echo $victim['victim_names'] . '<br />';
    }
	}
	
	catch(PDOException $e)
	{
	echo "error" . "<br>" . $e->getMessage();
	}
    $conn = null;
	?>
	</tr>
	</tbody>
	</table>
	<div id="pager" class="pager">
	<form>
	<img src="../images/first.png" class="first"/>
	<img src="../images/prev.png" class="prev"/>
	<input type="text" class="pagedisplay"/>
	<img src="../images/next.png" class="next"/>
	<img src="../images/last.png" class="last"/>
	<select class="pagesize">
	<option selected="selected"  value="10">10</option>
	<option value="20">20</option>
	<option value="30">30</option>
	<option  value="40">40</option>
	</select>
	</form>
	</div>
	</div>
	</div>
	</body>
	</html>

