Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Match Against help

Posted on 2009-05-19
3
Medium Priority
?
221 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

688 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