MySQL 4 - Match Against
| From: | jtjohnston | Date: | Sat, 06 Jul 2002 19:07:52 +0000 |
| Subject: | MySQL 4 - Match Against | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-102568@lists.php.net to get a copy of this message | ||
MySQL 4 & PHP Syntax Question
Re: MATCH AGAINST:
http://www.mysql.com/doc/F/u/Fulltext_Search.html
Bare with me, I'm a little rusty. I'm having a little trouble deciding
how to implement MATCH() AGAINST() in my PHP code:
articles = my table name
title,body are fields in my table 'articles'
This is my input from <input type=text name=searchenquiry value="+MySQL
-YourSQL">
This is how I mutate my PHP code:
#$news = mysql_query('select * from ccl_main where au like
'.$searchenquiry.' order by AU desc');
$news = mysql_query('SELECT * FROM ccl_main WHERE MATCH (au) AGAINST
('.$searchenquiry.' IN BOOLEAN MODE) order by AU desc');
while ($mydata = mysql_fetch_object($news))
{
echo
"<tr><th>$mydata->id</th><td>$mydata->au</td></tr>\n";
}
What other modes are there? What if my user does not type '+something
-something'?
Does anyone have any code to share how you made the transition from 3.23
to 4.0?