
<?php
	$login=mysql_connect('localhost', 'wauhaha_karaoke', 'cross123','wauhaha_karaoke');
	
	mysql_selectDB("wauhaha_karaoke",$login);
	$result =mysql_query('select * from admin');
	$r = mysql_fetch_array($result);
	$id = $r['Username']

?>
<html>
<head>
<title>
View Job Application
</title>
<script language="javascript"> 
function toggle() {
	var ele = document.getElementById("toggleText");
	var text = document.getElementById("displayText");
	if(ele.style.display == "block") {
    		ele.style.display = "none";
		text.innerHTML = "show";
  	}
	else {
		ele.style.display = "block";
		text.innerHTML = "hide";
	}
} 

</script>
<!--<a id='displayText' href='javascript:toggle();'>Details</a>
<div id='toggleText' style='display: none'>-->	


</head>
<body style="background-color: #ffffff;background-image:url(rail.jpg);background-repeat: repeat-y">
<center>
<?php include('link.php');?>
<center><a href=adminaccount.php title=Back><img src=back.jpg width=40 height=40></a> 
<?php
	$login=mysql_connect('localhost', 'wauhaha_karaoke', 'cross123','wauhaha_karaoke');
	
	mysql_selectDB("wauhaha_karaoke",$login);
?>
<h2 align=center><i>Admin View Job Application</i></h2>


<?php


if (isset($_GET["page"])) { $page  = $_GET["page"]; } else { $page=1; }; 
$start_from = ($page-1) * 5; 
$result2 = mysql_query("SELECT * FROM job ORDER BY Name ASC LIMIT $start_from,5");

echo "<table border=1 align=center style ='font-family:Arial, Helvetica, sans-serif;font-size:1em' color='blue' bordercolorlight='tan' cellspacing=0 cellpadding=4>
 <tr bgcolor=lightblue ><th>Name</th>
						<th>Gender</th>
						<th>Age</th>
						<th>Address</th>
						<th>Postcode</th>
						<th>IC</th>
						<th>Email</th>
						<th>Phone</th>
						<th>HPhone</th>
						<th>Position</th>
						<th>Delete</th>
						</tr>";


while($row2 = mysql_fetch_array($result2)){
  $Name=$row2['Name'];
  
  echo"<tr align='center' border=1>";
$no = $row2['no'];
  echo "<td border=1>".$row2['Name']."</td>";
  echo "<td border=1>".$row2['Gender']."</td>";
  echo "<td border=1>".$row2['Age']."</td>";
  echo "<td border=1>".$row2['Address']."</td>";
  echo "<td border=1>".$row2['Postcode']."</td>";
  echo "<td border=1>".$row2['IC']."</td>";
  echo "<td border=1>".$row2['Email']."</td>";
  echo "<td border=1>".$row2['Phone']."</td>";
  echo "<td border=1>".$row2['HPhone']."</td>";
  echo "<td border=1>".$row2['Position']."</td>";
  echo "<td border=1><a href=http://www.wauhaha.com/karaoke/admindeljob.php?Name=$no /><img src=delete.png width=20 height=20></a></td>";

  echo "</tr>";
  }
$sql = mysql_query("select COUNT(*) From job");  

$row=mysql_fetch_array($sql);
$total_records = $row[0];
$total_pages = ceil($total_records / 5);
echo "<center>";
for ($i=1; $i<=$total_pages; $i++) { 
	echo "<a href='viewapplyjob.php?page=".$i."'>&nbsp;" .$i. "&nbsp;</a>"; 
}; 
echo "</center>";
  
  echo "</table>";

mysql_close($login);


?>

	</body>
</html>	