Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $id_kelas=$_POST['kelas'];
- $id_ajaran=$_POST['ajaran'];
- ?>
- <?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'];
- $ARSISWA=array();
- $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
- $ARSISWA[$data1['nis']]= $data1['nilai_rapot'];
- var_dump($ARSISWA);
- //setelah di var_dump data array ada
- //array(1) { ["0525"]=> string(15) "7.6363636363636" } array(1) { ["0526"]=> string(1) "8" }
- //Hasil tampilan data di web
- }
- }
- ?></table>
- <table>
- <?php
- arsort($ARSISWA);
- $i=0;
- foreach($ARSISWA as $nm=>$val)
- {
- //data array di tampilkan kenapa kosong ?
- echo $nm; echo $val;
- }
- ?>
- </table>
Advertisement
Add Comment
Please, Sign In to add comment