<?php
include_once("../config.php");

$search_word_filter = "";
if(isset($_GET['search'])){
    $search_word = $_GET['search'];

    $search_word_filter = "AND attri_name LIKE '%$search_word%'";
}

$getAttributes = mysqli_query($db, "SELECT attri_name FROM `contact_attributes` WHERE client_id='$_SESSION[user_id]' $search_word_filter GROUP BY attri_name");
$attributeMenuItem = "";

while($attri = mysqli_fetch_assoc($getAttributes)){
    $attributeMenuItem .= "<div role='button' tabindex='0' style='cursor: pointer;'><div class='attri-name-selector' data-attri-name='$attri[attri_name]'>$attri[attri_name]</div></div>";
}

echo $attributeMenuItem;
?>