单击它们时,我无法选择任何建议。
我希望当我将鼠标悬停在建议上时可以单击、选择和更改颜色。
我怎样才能做到这一点?
这是我当前的代码:
<?php
include 'connect.php'; //connect with database
$query = $_GET["q"];
if($query != "")
{
$safequery = mysqli_real_escape_string($con,$query);
$stmt = "SELECT * FROM searchengine WHERE title LIKE '%" . $safequery . "%' OR keywords LIKE '%" . $safequery . "%' OR link LIKE '%" . $safequery . "%' LIMIT 4";
$result = mysqli_query($con,$stmt) or die(mysqli_error($con));
$number_of_result = mysqli_num_rows($result);
if ($number_of_result > 0)
{
//results found here and display them
while ($row = \mysqli_fetch_assoc($result))
{ //show first 10 results
//add $title to an array which you will call json_encode(arr) on.
$title = $row["title"];
echo "<div id='sugg-search-result'>";
echo "<div id='sugg-title'>" . $title . "</div>";
echo "</div>";
}
}
}
?>