<html>
<head>
<title>
View Staff
</title>
<script type="text/javascript" src="js/jquery-1.4.2.js"></script>
<script type='text/javascript' src="js/jquery.autocomplete.js"></script>
<link rel="stylesheet" type="text/css" href="js/jquery.autocomplete.css" />
<script language="javascript"> 
$().ready(function() {
	$("#mems").autocomplete("staffs.php", {
		width: 260,
		matchContains: true,
		//mustMatch: true,
		//minChars: 0,
		//multiple: true,
		//highlight: false,
		//multipleSeparator: ",",
		selectFirst: false
	});
});
</script>
</head>
<body style="background-color: #ffffff;background-image:url(rail.jpg);background-repeat: repeat-y">
<center>
<?php include('link.php');?>
</center>
<?php
	$login=mysql_connect('localhost', 'wauhaha_karaoke', 'cross123','wauhaha_karaoke');
	
	mysql_selectDB("wauhaha_karaoke",$login);
?>
<h2 align=center><i>Admin view Staff</i></h2>



<script type="text/javascript" src="js/jquery-1.4.2.js"></script>
<script type='text/javascript' src="js/jquery.autocomplete.js"></script>
<link rel="stylesheet" type="text/css" href="js/jquery.autocomplete.css" />
<script language="javascript"> 
$().ready(function() {
	$("#stas").autocomplete("sta.php", {
		width: 260,
		matchContains: true,
		//mustMatch: true,
		//minChars: 0,
		//multiple: true,
		//highlight: false,
		//multipleSeparator: ",",
		selectFirst: false
	});
});
</script>
<?php 
echo "<center><a href=adminaccount.php><img src=back.jpg width=40 height=40></a> &nbsp; <a href=adminaddstaff.php><img src=adds.jpg height=40 width=40></a></center>";

echo"
<form  method='post' target='_window' class='cmxform' id='signupForm' action='http://www.wauhaha.com/karaoke/staf.php' >
<table border='1' cellspacing='0' cellpadding='5' bordercolorlight='tan' align=center>
<tr>
	<td>Search by &nbsp;&nbsp;: &nbsp;
	IC
	</td>
	<td>Keywords:</td>
	<td><input type='text' name='stas' id='stas'></td>
	<td rowspan='2'><input type='submit' name='search' value='Search'>&nbsp;&nbsp;&nbsp;&nbsp;
</tr>
</table>

</form>";

?>
<?php
if (isset($_GET["page"])) { $page  = $_GET["page"]; } else { $page=1; }; 
$start_from = ($page-1) * 5; 
$result2 = mysql_query("SELECT * FROM staff ORDER BY StaffID 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>Staff ID</th>
						<th>Username</th>
						<th>Password</th>
						<th>Name</th>
						<th>Gender</th>
						<th>BOD</th>

				
			
						<th>IC</th>
				
						<th>HPhone</th>
						<th>Edit</th>
						<th>Delete</th>
						</tr>";


while($row2 = mysql_fetch_array($result2)){
  $StaffID=$row2['StaffID'];
  
  echo"<tr align='center'>";
  echo "<td border=1>".$row2['StaffID']."</td>";	
  echo "<td border=1>".$row2['Username']."</td>";
  echo "<td border=1>".$row2['Password']."</td>";
  echo "<td border=1>".$row2['Name']."</td>";
  echo "<td border=1>".$row2['Gender']."</td>";
  echo "<td border=1>".$row2['BDay']."</td>";


  echo "<td border=1>".$row2['IC']."</td>";


  echo "<td border=1>".$row2['HPhone']."</td>";
  echo "<td border=1><a href=http://www.wauhaha.com/karaoke/admineditstaff.php?StaffID=$StaffID /><img src=edit.jpg width=20 height=20></a></td>";
  echo "<td border=1><a href=http://www.wauhaha.com/karaoke/admindelstaff.php?StaffID=$StaffID /><img src=delete.png width=20 height=20></a></td>";

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

$row=mysql_fetch_array($sql);
$total_records = $row[0];
$total_pages = ceil($total_records / 5);

for ($i=1; $i<=$total_pages; $i++) { 
	echo "<center><a href='adminviewstaff.php?page=".$i." '  style='text-decoration:none'>&nbsp;".$i."&nbsp;</a><center> "; 
}; 
  echo "</table>";

mysql_close($login);
?>
</body>
</html>