<html>
<head>
<title>
Admin View Duty Time
</title>
</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);
	
?>
<body bgcolor="lightgrey">

<h2 align=center><i>Admin view Duty Time</i></h2>
<?php 
echo "<center><a href=adminaccount.php><img src=back.jpg width=40 height=40></a>";


?>

<?php
echo "<center><h4><b><u>Duty Time</u></b></h4></center>";


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=3 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>Name</th>
	<th >Arrange</th>
	<th >Edit</th>
	<th >View</th>
 </tr>";
 
 while($row2 = mysql_fetch_array($result2)){
  $StaffID=$row2['StaffID'];
  
  echo"<tr align='center' border=1>";
  echo "<td>".$row2['StaffID']."</td>";	
  echo "<td border=1>".$row2['Username']."</td>";
  echo "<td border=1>".$row2['Name']."</td>";
  echo "<td border=1><a href=http://www.wauhaha.com/karaoke/adminarrangedt1.php?StaffID=$StaffID /><img src=clock.png width=20 height=20></a></td>";
    echo "<td border=1><a href=http://www.wauhaha.com/karaoke/editdt.php?StaffID=$StaffID /><img src=edit.jpg width=20 height=20></a></td>";
  echo "<td border=1><a href=http://www.wauhaha.com/karaoke/adminviewdt.php?StaffID=$StaffID /><img src=view.jpg 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='dutytime.php?page=".$i." ' style='text-decoration:none'>&nbsp;".$i."&nbsp;</a><center> "; 
}; 
  echo "</table>";

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