Solved

Match Against help

Posted on 2009-05-19
3
213 Views
Last Modified: 2013-12-12
Dear Experts,

I have the following

$str_phrase = htmlentities($_GET['phrase']);

which is then used in a mysql query like so

where match (col1, col2) against ('$str_phrase')

But this does not let me use the + and - keys on the web page.  For example

Lets say the user types in the following

I am searching for information about +water -sand

It seems to ignore the + and - in that string.

How do I stop ignoring them?
0
Comment
Question by:narmi2
  • 2
3 Comments
 
LVL 10

Expert Comment

by:mahome
ID: 24421035
Yoiu must use boolean mode: http://dev.mysql.com/doc/refman/5.1/en/fulltext-boolean.html


where match (col1, col2) against ('$str_phrase' in boolean mode)

Open in new window

0
 
LVL 1

Author Comment

by:narmi2
ID: 24421154
I am using MySQL 3.XX and boolean mode did not exist until MySQL 4.XX
0
 
LVL 10

Accepted Solution

by:
mahome earned 500 total points
ID: 24421286
than you have to simulate it: seperate plus-phrases from minus-phrases:

where match (col1, col2) against ('$plusPhrase')

and not match(col1, col2) against ('$minusPhrase')

Open in new window

0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now