<?php
//fetch.php
$connect = mysqli_connect("localhost", "root", "", "olahdata");
$output = '';
if(isset($_POST["search"]))
{
	$search = mysqli_real_escape_string($connect, $_POST["search"]);
	$query = '
	SELECT * FROM klasifikasi_arsip WHERE jenis_arsip LIKE "%'.$search.'%" 
	OR kode_klasifikasi LIKE "%'.$search.'%" 
	';
}
else
{
 $query = "
  SELECT * FROM klasifikasi_arsip ORDER BY kode_klasifikasi
 ";
}
$result = mysqli_query($connect, $query);
if(mysqli_num_rows($result) > 0)
{
 $output .= '
  <div class="table-responsive">
   <table class="table table bordered">
    <tr>
     <th width=150>Kode Klasifikasi</th>
     <th>Jenis Arsip</th>
    </tr>
 ';
 while($row = mysqli_fetch_array($result))
 {
  $output .= '
   <tr>
    <td>'.$row["kode_klasifikasi"].'</td>
    <td>'.$row["jenis_arsip"].'</td>
   </tr>
  ';
 }
 echo $output;
}
else
{
 echo 'Data Not Found';
}

?>