Forum Moderators: coopster

Message Too Old, No Replies

what's the best method for search a MYSQL DB in PHP?

         

ocelot

12:06 am on Nov 10, 2004 (gmt 0)

10+ Year Member



what are my options when it comes to searching?

I will need the search to run on my 1&1 server, so what does that limit me to?

dip00dip

8:12 am on Nov 10, 2004 (gmt 0)

10+ Year Member



Try MySQL FULLTEXT search.
[dev.mysql.com...]

coopster

11:51 am on Nov 10, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



What are you searching? Or what are you searching for? A keyword in text column, a postal code, telephone number...?

And Welcome to WebmasterWorld, dip00dip.

willis1480

12:45 pm on Nov 10, 2004 (gmt 0)

10+ Year Member



if you are searching text, use MATCH(full_text_index) AGAINST('phrase or word').
I currently use this in a site search and it works a little funky. Not sure how it determines how good the matches are, but it is better than what I had before. The URL given a couple of posts earlier is about this.

If you are searching just a column like zip_codes, then just use simple LIKE comparison.

NOTE: The match will only match words of 4 characters and more.

lazydog

2:24 pm on Nov 10, 2004 (gmt 0)

10+ Year Member



NOTE: The match will only match words of 4 characters and more.

You can change this default setting of four characters by adding a line in your my.ini/my.cnf.
Here its set to 3 characters-

ft_min_word_len=3

willis1480

7:56 pm on Nov 10, 2004 (gmt 0)

10+ Year Member



i dont have access to that file, but I still was not aware that that could be changed. Also, I am not sure it is good to match words less than 4 characters. Building my site search, I found that less than four becomes very tricky, especially when dealing with truncating expressions in the plural and such.