<?php <!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Rangking</title>
<style type="text/css">
<!--
.style38 {font-size: 16px}
.style5 {color: #FF0000; font-weight: bold; font-size: 18px; font-family: "Times New Roman", Times, serif; }
-->
</style>
</head>
<body>
<table width="634" border="1" align="center" bordercolor="#0000FF">
<tr>
<td colspan="6"><div align="center"><span class="style5">Hasil</span></div></td>
</tr>
<tr bgcolor="#666666">
<td width="105" class="style15"><div align="center" class="style23 style38">No</div></td>
<td width="105" class="style15"><div align="center" class="style23 style38">Nip</div></td>
<td width="133" class="style15"><div align="center" class="style23 style38">Nama</div></td>
<td width="142" class="style15"><div align="center" class="style23 style38">Jurusan</div></td>
<td width="40" class="style15"><div align="center" class="style23 style38">Total</div></td>
<td width="69" class="style15"><span class="style23 style38">Rangking</span></td>
</tr>
<?php
$koneksi=mysql_connect("localhost", "root", "")
or die ("Gagal konek server".mysql_error());
mysql_select_db("spk",$koneksi)
or die ("Database gagal dibuka".mysql_error());
$ranking=mysql_query("select nip,nama,jurusan,total from hasil order by total desc");
$nip=$_POST['nip'];
$nama=$_POST['nama'];
$jur=$_POST['jurusan'];
$total=$_POST['total'];
if($total[$no]>=85) {$huruf[$no]='A'; $color='blue';}
elseif($total[$no]>=70) {$huruf[$no]='B'; $color='blue';}
elseif($total[$no]>=55) {$huruf[$no]='C'; $color='blue';}
elseif($total[$no]>=40) {$huruf[$no]='D'; $color='blue';}
else {$huruf[$no]='E'; $color='red';}
?>
<tr>
<td><?php echo $no;?></td>
<td><?php echo $nip;?></td>
<td><?php echo $nama;?></td>
<td><?php echo $jurusan;?></td>
<td><?php echo $total;?></td>
<td><?php echo $total[$no]?></td>
</tr>
<?php
$no++;
}
?>
</table>
</body>
</html> ?>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Rangking</title>
<style type="text/css">
<!--
.style38 {font-size: 16px}
.style5 {color: #FF0000; font-weight: bold; font-size: 18px; font-family: "Times New Roman", Times, serif; }
-->
</style>
</head>
<body>
<table width="634" border="1" align="center" bordercolor="#0000FF">
<tr>
<td colspan="6"><div align="center"><span class="style5">Hasil</span></div></td>
</tr>
<tr bgcolor="#666666">
<td width="105" class="style15"><div align="center" class="style23 style38">No</div></td>
<td width="105" class="style15"><div align="center" class="style23 style38">Nip</div></td>
<td width="133" class="style15"><div align="center" class="style23 style38">Nama</div></td>
<td width="142" class="style15"><div align="center" class="style23 style38">Jurusan</div></td>
<td width="40" class="style15"><div align="center" class="style23 style38">Total</div></td>
<td width="69" class="style15"><span class="style23 style38">Rangking</span></td>
</tr>
<?php
$koneksi=mysql_connect("localhost", "root", "")
or die ("Gagal konek server".mysql_error());
mysql_select_db("spk",$koneksi)
or die ("Database gagal dibuka".mysql_error());
$sql="select nip,nama,jurusan,total from hasil order by total desc";
$qry = mysql_query($sql, $koneksi)
or die ("Query Gagal ".mysql_error());
$nip=$_POST['nip'];
$nama=$_POST['nama'];
$jur=$_POST['jurusan'];
$total=$_POST['total'];
while($data=mysql_fetch_array($qry)){
if($total>=85) {$huruf='A'; $color='blue';}
elseif($total>=70) {$huruf='B'; $color='blue';}
elseif($total>=55) {$huruf='C'; $color='blue';}
elseif($total>=40) {$huruf='D'; $color='blue';}
else {$huruf='E'; $color='red';}
?>
<tr>
<td><?php echo $data['no'];?></td>
<td><?php echo $data['nip'];?></td>
<td><?php echo $data['nama'];?></td>
<td><?php echo $data['jurusan'];?></td>
<td><?php echo $data['total'];?></td>
<td><?php echo $huruf;?></td>
</tr>
<?php $no++;
}
?>
</table>
</body>
</html>