<html>
<head>

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


?>

<?php
$login=mysql_connect('localhost', 'wauhaha_karaoke', 'cross123','wauhaha_karaoke');
	
	mysql_selectDB("wauhaha_karaoke",$login);
	if (isset($_GET["page"])) { $page  = $_GET["page"]; } else { $page=1; }; 
	$start_from = ($page-1) * 5;
$result = mysql_query("select * from credittran ORDER BY CreNum Desc  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>Member ID</th>
 						<th>Username</th>
						<th>Name</th>
						<th>Add Credit</th>
						<th>Add Credit Date</th>
						<th>Minus Credit </th>
						<th>Minus Credit Date</th>
						<th>Edited Date</th>
						<th>Credit Bal</th>
						<th>Function</th>
						</tr>";


while($row2 = mysql_fetch_array($result)){
  $CreNum=$row2['CreNum'];
  
  echo "<tr align='center'>";
  

  echo "<td border=1>".$row2['MemID']."</td>";
  echo "<td border=1>".$row2['Username']."</td>";
  echo "<td border=1>".$row2['Name']."</td>";
  echo "<td border=1>".$row2['AddCredit']."</td>";
  echo "<td border=1>".$row2['AddCreditD']."</td>";
  echo "<td border=1>".$row2['MinusCredit']."</td>";
  echo "<td border=1>".$row2['MinusCreditD']."</td>";
  echo "<td border=1>".$row2['EditedD']."</td>";
  echo "<td border=1>".$row2['BalCredit']."</td>";
  
  echo "<td border=1><a href=http://www.wauhaha.com/karaoke/admineditcre.php?CreNum=$CreNum /><img src=edit.jpg width=20 height=20 alt=edit></a></td>";
  
  echo "</tr>";
 
  }

	$sql = mysql_query("select COUNT(*) From credittran");  

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

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

  echo "</table>";


?>