PHP Ajax Live Search Tutorial

Furqan Aziz | 13 Aug 2013 | Tutorials

PHP Ajax Live Search Tutorial
Social Box
Autosuggest is a user-friendly option which can be used in input fields for making interactive search. User starts typing the characters and if results match with stored data it will be displayed immediately below the search field. Everyone look for good live search functionality and we develop this tutorial for you. Live Search Tutorial is a PHP Ajax Based Live Search Tutorial which contains following pages and Folders.
    • Search.sql contains full database structure along with sample data.
    • index.php is file from where you can search using autosuggest.
    • search.php is a page which will gather search words from database and after user search redirects to php page.
    • Connection.php is a php file which contains connection options.
    • Style Folder contains css file for styling.
    • Scripts Folder contains javascript file for affects.
    • images Folder contains search icons.
  1. First download the source file and create following table in your database using search.sql code. We give database name as search.
    • country table contains country details like id, name of country.
    • CREATE TABLE IF NOT EXISTS `country` (
        `id` int(11) NOT NULL AUTO_INCREMENT,
        `name` varchar(255) NOT NULL,
        PRIMARY KEY (`id`)
      ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=24 ;
      -- Dumping data for table `country`
      INSERT INTO `country` (`id`, `name`) VALUES
      (1, 'Australia'),
      (2, 'Africa'),
      (4, 'Albania'),
      (5, 'Algeria'),
      (6, 'Andorra'),
      (7, 'Angola'),
      (8, 'Antarctica'),
      (9, 'Arabia, Saudi'),
      (10, 'Argentina'),
      (11, 'Armenia'),
      (12, 'Aruba'),
      (13, 'Asia'),
      (14, 'Australia'),
      (15, 'Austria'),
      (16, 'Azerbaijan'),
      (17, 'Bangladesh'),
      (18, 'Barbados'),
      (19, 'Belarus'),
      (20, 'Brazil'),
      (21, 'Bulgaria'),
      (22, 'Cambodia'),
      (23, 'Canada');
  2. Connection.php file contains connection options to your database. Change password according to your database password.
    • <?php
      $hostname_conn = "localhost";
      $database_conn = "search";
      $username_conn = "root";
      $password_conn = "";
      $conn = mysql_pconnect($hostname_conn, $username_conn, $password_conn) or trigger_error(mysql_error(),E_USER_ERROR); 
      mysql_select_db($database_conn,$conn);
      ?>
  3. Now Copy Live_PHP_Ajax_Search Folder in htdocs or www root folder of your server. Try it in the Browser and type country name in search field. It will show results immediately as you starts typing. Enjoy! For any query/suggestions please post a comment on our Facebook Page.
LATEST TUTORIALS
PHP MySQL Simple Delete using PDO in Bootstrap Tutorial
Convert Simple Text To 3D Text using Adobe Fireworks CS6 Tutorial
PHP Simple Update using PDO in Bootstrap Tutorial
PHP Simple Insert using PDO in Bootstrap Tutorial
PHP MySQL Easy CSV Data Insertion in Bootstrap using PDO Tutorial
PHP Easy Sign-in Using PDO Prepared Statement Tutorial
Easy PHP Email With Attachments using Swift Mailer Tutorial
Easy Pagination with PDO in PHP plus Export to Excel Tutorial
PHP PDO to Connect MySQL Database Tutorial
Best CSS Frameworks Collection For Rapid Web Development
PHP-MySQL Ajax Jquery-UI Autocomplete in Bootstrap Tutorial
PHP Simple Sign-in Tutorials
Jquery Raty Usage via PHP
PHP Dynamic Select options Via Ajax
CSV Importer in MySQL
PHP File Load Via Jquery into DIV
© 2014 CreWow Network - All Rights Reserved.