I have a single table with 4 text fields that I am currently searching using
WHERE `$field` LIKE '%$value%'
to match each field directly and ordering results by number of field matches. This was the most efficient method for me to code it (because of my extremely limited experience, however I realize it's not the most efficient method for user interface.
I'm just wondering what direction to take to create a more user-friendly search statement. I have been reading about different types of table searching, but I'm confused about which is the best method for my table.
Search form uses all 4 fields, only one needs to be filled out, and I'd like to order by relevance, however that is achieved. I don't want to get exact matches because of spelling errors and whatnot.
Here's the table I'm working with:
MySQL>EXPLAIN `so_customer_isam`;
-
Type: MyISAM
Collation: UTF8_bin
Primary Key: `id`
-
+------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+-------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| last_name | varchar(35) | NO | | NULL | |
| first_name | varchar(35) | NO | | NULL | |
| company | varchar(35) | YES | | NULL | |
| phone | varchar(35) | NO | | NULL | |
+------------+-------------+------+-----+---------+----------------+