...

February 10, 2004 by Kutt Niinepuu
There are two basic approaches. If you have the fields in the same database on the server, then it's fairly easy to compose the SELECT statement with the parameters (for the search strings) in the WHERE clause.

SELECT * FROM table1 WHERE field1=param1 AND field2=param2 (in case you want BOTH conditions to be true) or
SELECT * FROM table1 WHERE field1="param1" OR field2="param2" (when either condition can be true)

Now, if your data is spreaded over several tables, there is a strong chance that they have been connected with an universal ID-field, in this cas you could join the tables into one logical one in your SQL-statement and use the above method to find from several fields.

SELECT * FROM table1 LEFT JOIN table2 ON table1.id=table2.id

The "id" columns should be of the same type. It's unnecessary to write an SQL primer here, as the MySQL website provides adequate documentation with user comments and tips and there are some fabulous articles on the subject here in the Premium Content as well.
But if there is no "relation" between the tables you want to search from, then there's a way to use a dropdwon menu or a radio group to select the table from which to search.

RE: ...

February 10, 2004 by Kutt Niinepuu
The second sentence should read:
If you have the fields in the same TABLE in your database...
Sorry, my bad :)