View difference between Paste ID: 8XewZdnK and HGvzAnc3
SHOW: | | - or go back to the newest paste.
1
<?php 
2
	$id_kelas=$_POST['kelas'];	
3
	$id_ajaran=$_POST['ajaran'];
4
	$no=0;
5
	$a=0;
6
	$b=0;
7
	$c=0;
8
	$v=0;
9
	$y=0;
10
	$z=0;
11
	$f=0;
12
	$g=0;
13
	$h=0;
14
	$p=0;
15
	$e=0;
16
?>
17
<?php
18
$sql =" select * from tb_detailkelas 
19
			where id_kelas='$id_kelas' and id_ajaran='$id_ajaran'";
20
			$hasil = mysql_query($sql) ;//or die ("Kesalahan pada perintah SQL!");
21
			echo mysql_error();
22
			while ($data=mysql_fetch_array($hasil)){
23
		?>
24
			<tr>
25
				<td><?php 	$no; ?> </td>
26
				<td><?php 	$data['nis']?></td>
27
				
28
			</tr>
29
<?php 
30
$test=$data['nis'];
31
$ARSISWA=array();
32
$no++;
33
$sql1 =" select * from tb_rapot 
34
where nis='$test' and id_ajaran='$id_ajaran' order by nilai_rapot desc";
35
	$hasil1 = mysql_query($sql1) ;
36
37
	echo mysql_error();
38
	while ($data1=mysql_fetch_array($hasil1)){
39
	?>
40
	<tr>
41
		<td><?php 	$no; ?> </td>
42
		<td><?php 	$data1['nis']?></td>
43
		<td><?php 	$data1['nilai_rapot']?></td>
44
		
45
	</tr>
46-
			//$e1=$data['nis'];
46+
47-
			$d=$data1['nilai_rapot'];
47+
	   $ARSISWA[$data1['nis']]= $data1['nilai_rapot'];
48-
			//var_dump($d);
48+
49-
			if		($a=0){$a=$d; $f= $data1['nis'];}
49+
50-
			else if ($b=0){$b=$d; $g= $data1['nis'];}
50+
51-
			else if ($c=0){$c=$d; $h= $data1['nis'];}
51+
52-
			else if ($d>$a and $d>$b and $d>$c ){ $a=$d;  $h= $data1['nis'];}
52+
?></table>
53-
			else if ($d>$a and $d>$b and $d<$c ){ $b=$d;  $g= $data1['nis'];}
53+
54-
			else if ($d>$a and $d<$b and $d<$c ){ $c=$d;  $f= $data1['nis'];}
54+
<table>
55-
		}
55+
56
 arsort($ARSISWA);
57
$i=0;
58
foreach($ARSISWA as $nm=>$val)
59
{
60
$i++;
61
?><tr><td><?=$i;?></td><td><?=$nm;?></td>
62
<td><?=$val;;?></td></tr><?php
63
    if($i>=3) break;
64-
if($a>$b && $a>$c){$y=1;}
64+
}
65-
else if($b>$c){$v=2;}
65+
66-
else{$z=3;}
66+
</table>