<?php
include '../koneksi.php';

$keyword = $_POST['unit'];

$query = mysqli_query($konek, "
    SELECT * FROM unit
    WHERE nama_unit LIKE '%$keyword%'
    LIMIT 5
");

if (mysqli_num_rows($query) > 0) {
    while ($row = mysqli_fetch_assoc($query)) {
        echo '<div class="list-group-item unit-item" 
                data-nama="'. $row['nama_unit'].'">
                ' . $row['nama_unit'] .
            '</div>';
    }
}
