Today, We want to share with you PHP AJAX Live Search Box Autocomplete Using MySQL Database.In this post we will show you PHP Jquery AJAX Live Search Box Using MySQL, hear for PHP MySQL Live Search Box using Jquery Ajax Example we will give you demo and example for implement.In this post, we will learn about Jquery Ajax Live Search Box using PHP MySql with an example.
PHP AJAX Live Search Box Autocomplete Using MySQL Database
There are the Following The simple About PHP AJAX Live Search Box Autocomplete Using MySQL Database Full Information With Example and source code.
As I will cover this Post with live Working example to develop ajax live data search using jquery php mysql, so the some major files and Directory structures for this example is following below.
- index.php
- fetch.php
Step 1: Creating the Database Table
— Database: `member_list` >> — Table structure for table `member_tbl`
CREATE TABLE IF NOT EXISTS `member_tbl` ( `MemberID` int(11) NOT NULL AUTO_INCREMENT, `MemberName` varchar(250) NOT NULL, `member_addr` text NOT NULL, `member_city` varchar(250) NOT NULL, `member_pcode` varchar(30) NOT NULL, `member_country` varchar(100) NOT NULL, PRIMARY KEY (`MemberID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=14 ;
Step 2: Dumping data On Table
Dumping data for table `member_tbl`
//ajax live data search using jquery php mysql INSERT INTO `member_tbl` (`MemberID`, `MemberName`, `member_addr`, `member_city`, `member_pcode`, `member_country`) VALUES (1, 'Jaydeep Gondaliya', 'sejal Str. 57', 'Berlin', '12209', 'Germany'), (2, 'Ankit Kathiriya', 'Avda. de la Ram park 2222', 'USA D.F.', '5021', 'USA'), (3, 'Krunal Sisodiya', 'sardha 2312', 'USA D.F.', '5475', 'USA'), (4, 'chirag dethariya', '120 dsp salon Sq.', 'London', 'WA1 1DP', 'UK'), (5, 'Dhaval dave', 'Rua do Ganesh, 12', 'Resende', '56458-363', 'UEA'), (6, 'Pooja solanki', 'ul. astha 68', 'Walla', '01-658', 'Poland'), (7, 'Bhakti Banugariya', 'kavya 45', 'Helsinki', '2853', 'India'), (8, 'Nilesh chandvadiya', '305 - 14th Ave. S. Suite 3B', 'Seattle', '98128', 'USA'), (9, 'Hitesh Ajani', 'Rua do Ganesh, 12', 'Resende', '098952-363', 'UEA'), (10, 'Mayur Dhameliya', 'bhakti 38', 'Oulu', '321452', 'India'), (11, 'Stavan Patel', '2, rue du chandni', 'Reims', '350024', 'France'), (12, 'Parag shukla', '722 Titupati Blvd.', 'Kirkland', '360002', 'USA'), (13, 'Vijay bhanderi', 'Bhavanath. 48', 'Butte', '225010', 'USA');
Step 3: Creating the Search Form
index.php
This is where I will make a simple HTML form and PHP server side source code for our web application. To make the forms simply all souce code copy and write it into your any text editor Like Notepad++, then save file it as index.php.
PHP AJAX Live Search Box Autocomplete Using MySQL Database $(document).ready(function(){ ajax_data_load(); function ajax_data_load(query) { $.ajax({ url:"fetch.php", method:"POST", data:{query:query}, success:function(data) { $('#result').html(data); } }); } $('#query_search').keyup(function(){ var search = $(this).val(); if(search != '') { ajax_data_load(search); } else { ajax_data_load(); } }); });
PHP AJAX Live Search Box Autocomplete Using MySQL Database
Simple ajax live data search using jquery php mysql
Search
Step 4 : Processing Search Query in Backend
fetch.php for PHP AJAX Live Search Box Autocomplete server side source code
0) { $output .= '
'; while($memres = mysqli_fetch_array($result)) { $output .= ' Member Name member Address member_city Member Post Code member_country '; } echo $output; } else { echo 'Data Not Found'; } ?> '.$memres["MemberName"].' '.$memres["member_addr"].' '.$memres["member_city"].' '.$memres["member_pcode"].' '.$memres["member_country"].' 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 AJAX Live Search Box Autocomplete Using MySQL Database.
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.