I want to show my database value when use type first character of the value. Let me describe it with my site I have a website with homepage input where user type input as t
check this code .i think it will help you
PHP, jQuery search demo
Search results :
first create html and jquery code for input field which you type then call jquery function keyup which hit database using ajax method then create a php file which manage your search i create a search.php file
connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT filed1, field2 FROM yourtable_name WHERE match_text LIKE '%$searchquery%'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo " - Name: " . $row["filed1"]. " " . $row["field2"]. "
";
}
} else {
echo "0 results";
}
$conn->close();
?>
from this page you will get your search result and you can change it as your demand . for your check you can also add search text length if you do not search if search text length > 2 or etc