Solved

Match Against help

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
unset shopping cart session 15 33
How to count in a table in php 22 19
Testing a string condition in PHP 6 10
paypal ipn to mysql 3 6
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
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…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

863 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

22 Experts available now in Live!

Get 1:1 Help Now