tags:

views:

45

answers:

3

I am using this to search my table:

  if ($querystring!=''){$query_cont .= " AND MATCH (headline) AGAINST ('$querystring')"; }

Thing is, in the 'headline' field I have a value of say 'BMW'. Then when I enter BMW in the search field, that is "$querystring = 'BMW'", no results are found.

I have set the index of the 'headline' field to 'fulltext', and I insert values to that table with the simple 'INSERT INTO' statement.

Please help me out with this one...

Let me know if you need more input!

+2  A: 

There are two things you have to know:

I suspect one of these things is preventing you from getting the results you expect.

Also please make sure your application is protected from Sql injections

Tomh
+2  A: 
Quassnoi
+2  A: 

MySQL's fulltext indexer ignores three-letter words by default. To get 3-letter words indexed you will need to change the ft_min_word_len config and re-index the columns (see this question for more; there are also many more stopwords than you might expect).

(You will also need to use mysql_real_escape_string or parameterised queries to stop your above code being an SQL injection vulnerability.)

bobince