Searching a database online

Making a MYSQL Database Searchable

As with flat file databases search routines are complex and are often put in place using third party programs and scripts.

Some of the free CGI tools allow searching (Matt's Scripts and DB_Browser).


If you use these tools you will however need to allow your user a login password into the Mysql database which restricts the usefulness of these free software packages.


Using Dreamweaver Routines to Search your database

It is possible to set up your own search pages using Dreamweaver Look at the data search page set up for the MySQL database 'Attractions'. This is a database of tourist attractions in South West England

You will see that this is a simple keyword search. To search different fields a separate search box is used. The results appear on a separate results page.

Search Attractions Database


How to set up a search page

1. Create a search page. This is a normal HTML page. You set up the search using a form with a text box or list/menu

2. Create a Results Page
This will be a dynamic page. The page will collect the request from the search form and look in the database for a match

(1) Name the Recordset
(2) Establish the connection to your MySQL database
(3) Select the database to be searched
(4) The centre box will fill with the database fields. You can select whatever fields you want your query results to display
(5) In the Filter box you select the field to be searched. Leave the = if you want exact matches
(6) If your search form method is GET select URL Parameter below the filter box. Alongside give the name of the search form on the search page
(7) Click OK and the dynamic table will be placed onto your page (You can test on line using the test option to see if the query returns the right result

(3) Test your work
When the two pages are uploaded you should call the search page and test it. The r4esults will appear in the results page if you have done it right!

Adding and deleting Records