Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: php search page
03-23-2009, 09:32 PM #1
- Join Date
- Mar 2009
- Thanked 0 Times in 0 Posts
php search page
need some advice on the best way to make a search page in php for a mysql database.
The database contains 3 columns with CSV's. The CSV's are all taken from a set list of about 20 different values.
I want users to be able to search for each row for different values using dropdowns or checkboxes.
For example, for row 1:
column a = "apples, pears, oranges"
column b = "red, black, green"
column c = "wood, stone, water"
so a user might want to find a row with columns a, b or c containing ALL of apples, oranges, red and stone **OR** ANY of apples, oranges, red and stone (preferably in the latter case sorted by the number of matched occurrences).
I'm familiar with the syntax for a basic search, but can't put together a query for this that does what I want it to.
Thank you in advance....
03-23-2009, 11:21 PM #2
- Join Date
- Dec 2005
- Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
- Thanked 637 Times in 625 Posts
The easy way is with the use of a FULLTEXT index. This is a MySQL index that gives you boolean search capabilities, so a search string of "+apples +pears +oranges" will only hit if all three words are found.
I would also nag you to normalize your data. Good article about it:
For more information on this type of index: