Advertisement
Guest User

Untitled

a guest
Nov 18th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.94 KB | None | 0 0
  1.  <!DOCTYPE html>
  2.     <html>
  3.     <head>
  4.         <link rel="stylesheet" href="css/bootstrap.min.css" />
  5.         <link rel="stylesheet" href="css/font-awesome.min.css" />
  6.         <link rel="stylesheet" href="css/style.css" />
  7.     </head>
  8.     </html>
  9.     <body>
  10.         <?php include 'koneksi.php'; ?>
  11.  
  12.         <div class="container">
  13.             <div class="row">
  14.                 <div class="col-md-2"></div>
  15.                 <div class="col-md-8">
  16.                     <h1 class="h1 text-center">ID3 Algorithm</h1>
  17.                 </div>
  18.             </div>
  19.             <div class="row">
  20.                 <div class="col-md-2"></div>
  21.                 <div class="col-md-8">
  22.                 </div>
  23.                 <div class="col-md-2"></div>
  24.             </div>
  25.             <div class="row">
  26.                 <div class="col-md-2"></div>
  27.                 <div class="col-md-8">
  28.                     <div class="table-responsive">
  29.                         <table class="table table-bordered table-condensed table-hover">
  30.                             <tr>
  31.                                 <th>Nama</th>
  32.                                 <th>tugas1</th>
  33.                                 <th>tugas2</th>
  34.                                 <th>uts</th>
  35.                                 <th>uh</th>
  36.                                 <th>uas</th>
  37.                                 <th>nilai akhir</th>
  38.                             </tr>
  39.                             <?php
  40.                             $query = "SELECT * FROM nilai_siswa";
  41.                             $data  = mysqli_query($konek,$query);
  42.                             foreach($data as $w)
  43.                             {
  44.                                 ?>
  45.                                 <tr>
  46.                                     <td><?= $w['nama'] ?></td>
  47.                                     <td><?= $w['tugas1'] ?></td>
  48.                                     <td><?= $w['tugas2']?></td>
  49.                                     <td><?= $w['UH'] ?></td>
  50.                                     <td><?= $w['UTS'] ?></td>
  51.                                     <td><?= $w['UAS']?></td>
  52.                                     <td><?= $w['Nilai_Akhir']?></td>                                    
  53.                                 </tr>
  54.                                 <?php
  55.                             }
  56.                             ?>
  57.                         </table>
  58.                     </div>
  59.                 </div>
  60.             </div>
  61.             <br>
  62.             <!-- menghitung siswa lulu dan tidak -->
  63.             <?php
  64.             $siswa      = "SELECT COUNT(Nilai_Akhir) as jumlah from nilai_siswa";
  65.             $datasis    = mysqli_query($konek,$siswa);
  66.             $resultsis  = mysqli_fetch_array($datasis);
  67.             echo "jumlah siswa ".$resultsis['jumlah'];
  68.             echo "<br>";
  69.  
  70.             $lulus      = "SELECT COUNT(Nilai_Akhir) as jumlah from nilai_siswa where Nilai_Akhir>=75";
  71.             $datalul    = mysqli_query($konek,$lulus);
  72.             $resultlul  = mysqli_fetch_array($datalul);
  73.             echo "jumlah siswa lulus ".$resultlul['jumlah'];
  74.             echo "<br>";
  75.  
  76.             $gagal      = "SELECT COUNT(Nilai_Akhir) as jumlah from nilai_siswa where Nilai_Akhir<75";
  77.             $datagag    = mysqli_query($konek,$gagal);
  78.             $resultgag  = mysqli_fetch_array($datagag);
  79.             echo "jumlah siswa gagal ".$resultgag['jumlah'];
  80.             echo "<br>";
  81.             echo "<hr>";
  82.  
  83.  
  84.             // <!-- menghitung data total tabel nilai uas -->
  85.  
  86.             $uastotal  =  "SELECT COUNT(UAS) as jumlah FROM nilai_siswa";
  87.             $duastot   = mysqli_query($konek,$uastotal);
  88.             $resultot = mysqli_fetch_array($duastot);
  89.             echo "jumlah total uas ".$resultot['jumlah'];
  90.             echo "<br>";
  91.  
  92.             // <!-- menghitung data total tabel nilai uts -->
  93.  
  94.             $utstotal  =  "SELECT COUNT(UTS) as jumlah FROM nilai_siswa";
  95.             $dutstot   = mysqli_query($konek,$utstotal);
  96.             $resultot2 = mysqli_fetch_array($dutstot);
  97.             echo "jumlah total uts ".$resultot2['jumlah'];
  98.             echo "<br>";
  99.             echo "<hr>";
  100.            
  101.  
  102.             // <!-- menghitung data lulus dan gagal  tabel nilai uts -->
  103.            
  104.             $uts = "SELECT COUNT(UTS) as jumlah FROM nilai_siswa where UTS >=75";
  105.             $duts   = mysqli_query($konek,$uts);
  106.             $result = mysqli_fetch_array($duts);
  107.             echo "jumlah uts lulus ".$result['jumlah'];
  108.             echo "<br>";
  109.             $uts2 = "SELECT COUNT(UTS) as jumlah FROM nilai_siswa where UTS <75";
  110.             $duts2  = mysqli_query($konek,$uts2);
  111.             $result2 = mysqli_fetch_array($duts2);
  112.             echo "jumlah uts gagal ".$result2['jumlah'];
  113.             echo "<br>";
  114.             echo "<hr>";
  115.  
  116.             // <!-- menghitung data lulus dan gagal  tabel nilai uts -->
  117.  
  118.             $uas    = "SELECT COUNT(UAS) as jumlah FROM nilai_siswa where UAS >=75";
  119.             $duas   = mysqli_query($konek,$uas);
  120.             $result = mysqli_fetch_array($duas);
  121.             echo "jumlah uas lulus ".$result['jumlah'];
  122.             echo "<br>";
  123.             $uas2    = "SELECT COUNT(UAS) as jumlah FROM nilai_siswa where UAS <75";
  124.             $duas2   = mysqli_query($konek,$uas2);
  125.             $result2 = mysqli_fetch_array($duas2);
  126.             echo "jumlah uas gagal ".$result2['jumlah'];
  127.             echo "<br>";
  128.  
  129.             // $total= 0;
  130.             // echo "jumlah ".$total = $resultot['jumlah']+$resultgag['jumlah'];
  131.            
  132.            //  <!-- mencari entropy semseta -->
  133.            // <!--  <?php
  134.             $entropytot = 0;
  135.             if (is_numeric($lulus) && is_numeric($gagal) && is_numeric($siswa)) {
  136.             $entropytot = (-($lulus/$siswa)*log($lulus/$siswa,2)+(-($gagal/$siswa)*log($gagal/$siswa,2)));
  137.         }
  138.            
  139.             echo "<br>";
  140.              echo "entropynya : ".$entropytot;
  141.            ?>
  142.        </div>
  143.    </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement