<?php
require_once '../config.php';
if(isset($_POST['product'])){
    $search = $_POST['product'];
    $pro = $db->query("SELECT * FROM games_guest WHERE name LIKE '%".$search."%'");
    if(mysqli_num_rows($pro) !== 0){
    if($search !== ""){
    while($test = $pro->fetch_assoc()){
    $slug = $test['slug'];
    $img = $test['img'];
    $name = $test['name'];
    $sub_name = $test['sub_name'];
?>
    <li><a class="dropdown-item" href="<?= base_url('id/product/'.$slug);?>">
        <div class="row">
            <div class="col-3">
                <img src="<?= base_url('assets/games/'.$img);?>" alt="" class="img-fluid" style="border-radius: 8px;">
            </div>
            <div class="col-9">
                <div class="row">
                    <div class="col-md-12">
                        <b><?= $name;?></b>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-12">
                        <small><?= $sub_name;?></small>
                    </div>
                </div>
            </div>
        </div></a></li>
        <hr class="dropdown-divider">
<?php
}
}else{?>
    <li><a class="dropdown-item" href="">
        <div class="row">
            <div class="col-12">
                <b>Silahkan Masukkan nama product</b>
            </div>
        </div></a></li>
<?php
}
}else{?>
    <li><a class="dropdown-item" href="">
        <div class="row">
            <div class="col-12">
                <b>Tidak Ditemukan</b>
            </div>
        </div></a></li>
<?php 
}
}else{?>

<?php }?>