March 28, 2011

PHP Auto-Suggest Search- JAVAScript PHP & MySQL

Sponsored Links

Today I walk through with woork while googling an auto suggest tool for PHP. I though to share it with you guys. Here’s a glimpse of this tool.  All you need is a little knowledge of PHP and MySql Database to customize few parameters that will work for you. I will go pretty with your customized website or a wordpress blog.

For WordPress:

Look into your database where your Post’s Title are fitted in and just customize the Database parameters to work for you.

It’s Simple.

PHP component ready to use to implement a search form with an autosuggest feature using PHP and MySQL.For all ajax beginners this is the most simple way to implement it (just with 8Kb) and the only thing you have to do is modify some parameters. Take a look at this post for all related infos.

php-components


DOWNLOAD SOURCE CODE

Before to start

Before to start, take a look at content of package:

autosuggest2

In detail:

- autosuggest.php include a form to search something into your database.
- ajax_framework.js enables ajax functionalities
- search.php contains a standard query to looking for something into some DB table
- config.php includes DB connection parameters

Ok. Now?

Step 1: include autosuggest.php

Create a new PHP page (for example index.php) in the same folder (don’t change it, ok?) where is autosuggest.php:

autosuggest-3

Open index.php and include autosuggest.php where you want into the tag:

include(‘autosuggest.php’)?>

…in this way you include the search form into your page.

Step 2: modify config.php

Change MySQL connection parameters in config.php:

autosuggest-4

Step 3: modify query parameters

In search.php you have to modify some query parameters. Not fear, is very simple.
For example, image you use your autosuggest to find all books of a certain author and your database has a table (BOOK) with two attributes book_title, and book_author. What do you have to do?
At line 23 you’ll cange “USER” with the table you have, “BOOK” and at line 24 “name” with book_author:

autosuggest-51

At line 43 change “NAME” with the attribute you want in output, in this case wih book_title.

Nothing else!

CSS customizing

If you want you can change the look of each autosuggest element modifying the CSS code into autosuggest.php:

autosuggest-6

DOWNLOAD SOURCE CODE

4 comments:

drupal website developer on April 19, 2011 at 4:57 AM said...

Its really quite interesting and amazing blog which helps in searching web designing languages like Java script,PHP and MYSQL.For Word Press blogging we require little knowledge about PHP and MYSQL customize features.

Kenki on July 17, 2011 at 8:45 AM said...

Nice autosuggest plug-in
but how to add a script
send back the result to textbox once i click the suggestion??

Thanks a lot

rai on December 2, 2011 at 6:12 PM said...

..tnx so simple and so useful..:D keep it up\m/

rai on December 2, 2011 at 7:20 PM said...

..nice tnx for sharing..so simple and so useful:D

Post a Comment

Have something to share? Comment it!

Not relevant? Take help with Search.

Custom Search

 

Updates on your Mobile

Updates on your Mobile
Go to m.techeguide.com from your mobile to get free access to updates, anytime & anywhere.

Recent Comments

Subscribed Yet?

Subscibe for email updates

© 2009 TecheGuide. The content is copyrighted to the author Mohit Tripathi and may not be republished on other websites. | View Privacy Policy |