- 06
- Nov

There might be many reasons why you may be storing data in a database. As Google has showed us, searching data is an invaluable tool that can help minimize the time that it takes to find the information you need.
I would like to show you how you can build your own PHP search engine to find the information you seek in a MySQL database.
First you will need a LAMP to work from. For Windows users a quick and dirty way is to download and install XAMPP. For Linux users try searching Google for a tutorial.
OK, now we will skip to the part where you have a working LAMP install and a database that needs searching from a web interface. I will assume that you have basic knowledge of and where to put your PHP files and also some basic SQL query syntax.
NOTE: I am not including “<?php” at the beginning of documents, nor “?>” at the end I will assume that you will know that these are the operators to signify php code within a file. You may also download the zip file that contains all of the code examples listed below at the end of this document.
Step 1: We are going to create a config.php file with our database information. Please fill in the correct information for your MySQL database and save the file:
-
$dbhost=‘127.0.0.1′;
-
$dbusername=‘db_username’;
-
$dbuserpass=‘db_password’;
-
$dbname = ‘db_name’;





