Solved

Match Against help

Posted on 2009-05-19
3
218 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 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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…

726 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