Autocomplete Textbox using jQuery, PHP and MySQLi

Autocomplete Textbox using jQuery, PHP and MySQLi

Today, We want to share with you Autocomplete Textbox using jQuery, PHP and MySQLi.
In this post we will show you Autocomplete Textbox using jQuery, PHP and MySQLi, hear for Autocomplete Textbox using jQuery, PHP and MySQLi we will give you demo and example for implement.
In this post, we will learn about Autocomplete Textbox using jQuery, PHP and MySQLi with an example.

Steps : autocomplete textbox using jquery ajax in php

I hope Ajax Simple Autocomplete textbox(search data) is extremely any user friendly and easy to find for any Website.
New things are Autocomplete search BOX is a most imp. feature that suggests(Like j characters search to display result java,javascript,joomla,etc..) all the list of available options display for selection based string on the get to characters keyed in by the user specifc result.

File name : db.php




Create a Table structure for table `autocomplete_pakainfo`


CREATE TABLE IF NOT EXISTS `autocomplete_pakainfo` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(60) NOT NULL,
  `email` varchar(60) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;

Simple Query Execute to insert some records in mysql

INSERT INTO `autocomplete_pakainfo` (`id`, `name`, `email`) VALUES
(1, 'admin', '[email protected]'),
(2, 'php', '[email protected]'),
(3, 'laravel', '[email protected]'),
(4, 'angularjs', '[email protected]'),
(5, 'ci', '[email protected]'),
(6, 'asp.net', '[email protected]');

File Name : index.php




Simple Autocomplete search using php, mysql and ajax : Example



	
  Ex:Laravel, PHP, Angularjs

search.php


include('db.php');//inclde database connection
if($_POST) //check if condition
{
	$query_data=$_POST['search'];
	$sql_res=mysql_query("select id,name,email from autocomplete where name like '%$query_data%' or email like '%$query_data%' order by id LIMIT 5");
	while($row=mysql_fetch_array($sql_res))
	{
		$name_users=$row['name'];
		$email=$row['email'];
		$business_usernames=''.$query_data.'';
		$business_email=''.$query_data.'';
		$latest_finals_usernames = str_ireplace($query_data, $business_usernames, $name_users);
		$latest_finals_emails = str_ireplace($query_data, $business_email, $email);
		?>
		
Autocomplete Textbox using jQuery, PHP and MySQLi 

We hope you get an idea about Autocomplete Textbox using jQuery, PHP and MySQLi
We would like to have feedback on my Information blog .
Your valuable any feedback, Good question, Inspirational Quotes, or Motivational comments about this article are always welcome.
If you liked this post, Please don’t forget to share this as Well as Like FaceBook Page.

We hope This Post can help you.......Good Luck!.

Leave a Comment