Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $id_kelas=$_POST['kelas'];
- $id_ajaran=$_POST['ajaran'];
- $no=0;
- $a=0;
- $b=0;
- $c=0;
- $v=0;
- $y=0;
- $z=0;
- $f=0;
- $g=0;
- $h=0;
- $p=0;
- $e=0;
- ?>
- <?php
- $sql =" select * from tb_detailkelas
- where id_kelas='$id_kelas' and id_ajaran='$id_ajaran'";
- $hasil = mysql_query($sql) ;//or die ("Kesalahan pada perintah SQL!");
- echo mysql_error();
- while ($data=mysql_fetch_array($hasil)){
- ?>
- <tr>
- <td><?php $no; ?> </td>
- <td><?php $data['nis']?></td>
- </tr>
- <?php
- $test=$data['nis'];
- $no++;
- $sql1 =" select * from tb_rapot
- where nis='$test' and id_ajaran='$id_ajaran' order by nilai_rapot desc";
- $hasil1 = mysql_query($sql1) ;
- echo mysql_error();
- while ($data1=mysql_fetch_array($hasil1)){
- ?>
- <tr>
- <td><?php $no; ?> </td>
- <td><?php $data1['nis']?></td>
- <td><?php $data1['nilai_rapot']?></td>
- </tr>
- <?php
- //$e1=$data['nis'];
- $d=$data1['nilai_rapot'];
- //var_dump($d);
- if ($a=0){$a=$d; $f= $data1['nis'];}
- else if ($b=0){$b=$d; $g= $data1['nis'];}
- else if ($c=0){$c=$d; $h= $data1['nis'];}
- else if ($d>$a and $d>$b and $d>$c ){ $a=$d; $h= $data1['nis'];}
- else if ($d>$a and $d>$b and $d<$c ){ $b=$d; $g= $data1['nis'];}
- else if ($d>$a and $d<$b and $d<$c ){ $c=$d; $f= $data1['nis'];}
- }
- }
- ?>
- <?php
- if($a>$b && $a>$c){$y=1;}
- else if($b>$c){$v=2;}
- else{$z=3;}
- ?>
- <td>NIS:<?php echo $h; ?> </td><td>rangking :<?php echo $y; ?></td>
- <td>NIS:<?php echo $g; ?> </td><td>rangking :<?php echo $v; ?></td>
- <td>NIS:<?php echo $f; ?> </td><td>rangking :<?php echo $z; ?></td>
Advertisement
Add Comment
Please, Sign In to add comment