Today, We want to share with you PHP MySQL ajax Autocomplete Live Search Box in jQuery.In this post we will show you ajax live data search using jquery php mysql, hear for Autocomplete Textbox using jQuery, PHP and MySQL we will give you demo and example for implement.In this post, we will learn about Build Live Search Box Using PHP, MySQL And AJAX with an example.
PHP MySQL ajax Autocomplete Live Search Box in jQuery
There are the Following The simple About PHP MySQL ajax Autocomplete Live Search Box in jQuery Full Information With Example and source code.
As I will cover this Post with live Working example to develop ajax search box php mysql like google, so the autocomplete search box in php mysql for this example is following below.
Step 1: Database Design:
simple Example for Build Live Search Box Using PHP, MySQL And AJAX
MySQL Database Table
CREATE TABLE 'product_name' ( product_id INT(20) PRIMARY KEY, company_name TEXT );
Step 2: Designing Front-end :
index.html
<html> <head> <title>Ajax Search Box using PHP and MySQL</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="js/typeahead.min.js"></script> </head> <body> <h1>Ajax Search Box in PHP, MySQL and JQuery</h1> <input type="text" name="typeahead"> </body> </html>
Step 3: Calling PHP Script Using GET
index.html
<script> $(document).ready(function(){ $('input.typeahead').typeahead({ name: 'typeahead', remote:'search.php?key=%QUERY', limit : 10 }); }); </script>
Step 4: Retrieving data from MySQL and returning as JSON:
search.php
<?php $key=$_GET['key']; $productArr = array(); $con=mysqli_connect("localhost","root","","examples"); $sqlqq=mysqli_query($con, "select * from products where title LIKE '%{$key}%'"); while($row=mysqli_fetch_assoc($sqlqq)) { $productArr[] = $row['title']; } echo json_encode($productArr); mysqli_close($con); ?>
Angular 6 CRUD Operations Application Tutorials
Read :
Summary
You can also read about AngularJS, ASP.NET, VueJs, PHP.
I hope you get an idea about PHP MySQL ajax Autocomplete Live Search Box in jQuery.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.
I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I’m a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.