Category Archives: php

PHP Auto-Suggest Search- JAVAScript PHP & MySQL

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.



Before to start

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


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:


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


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

Step 2: modify config.php

Change MySQL connection parameters in config.php:


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:


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:



How to become a web developer?

There’s a HECK of a lot to learn to be able to do web development effectively. Just to be ABLE to do it, you have to learn:


  • HTML
  • CSS
  • PHP or some other server-side language

To do it EFFECTIVELY, you’ve got a lot more to learn:

  • SQL
  • JavaScript
  • libraries and frameworks
  • a bug tracking system
  • Subversion or some other revision control system
  • IDEs
  • other tools
  • Apache
  • Linux command line

To do it WELL, there’s even more:

  • usability
  • unobtrusive JavaScript
  • separation of concerns (MVC, etc)
  • testing
  • customer relations 
  • HTTP protocol
  • AJAX

I think that skipping PHP and the others and going straight to Rails is a good idea. Maybe. At least if he’s talented. But he’ll still have to learn a lot of things before he’s any good at creating a site. (Don’t forget that we found Rails easy to learn because we already knew a lot about web development.) He’ll still have to understand HTML and CSS. The Agile Web Development with Rails books is excellent, but it takes a lot to get through. If you’re the type who can read a manual to learn how to do something, then it’s fine. But if you need to start out with a tutorial, then you’ll need to start with a different book. If you do go this route, I’d recommend learning in this order:

  • HTML
  • CSS
  • Apache (as little as possible to get 2 virtual hosts running)
  • Rails
  • Subversion
  • Test-Driven Development
  • Ruby
  • SQL

If you want to make a living at it, I’d expect it to take at least a year of full-time (self-)education. Everyone learns differently, so it’s hard to recommend learning materials. I’ll offer some ideas though:

  • books (my favorite; I look for conciseness)
  • formal training classes
  • (community) college classes
  • local user groups (attend if topic is pertinent)
  • online videos/screencasts
  • podcasts
  • web tutorials
  • blogs (hard to get the basics though)
  • personalized training
  • mentoring

If he just wants to play around, I suppose the order is not as important. Learn things as they interest you. Eventually, you’ll find you’ve learned a ton and enjoyed doing it.