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

$keyword = $_POST['keyword'];
$bu      = $_POST['bu'];

$query = mysqli_query($konek, "
    SELECT *
    FROM customeb
    WHERE bu = '$bu'
      AND nama_customer LIKE '%$keyword%'
    GROUP BY nama_customer
    LIMIT 5
");

if (mysqli_num_rows($query) > 0) {
    while ($row = mysqli_fetch_assoc($query)) {
        echo '<div class="list-group-item customer-item" 
                data-idcustomer="' . $row['idcustomer'] . '"
                data-nama="' . $row['nama_customer'] . '"
                data-alamat="' . $row['alamat'] . '"
                data-email="' . $row['email'] . '"
                data-telp="' . $row['telp'] . '"
                data-kota="' . $row['kota'] . '">
                ' . $row['nama_customer'] .
            '</div>';
    }
}
