Ray,

I admit, it is a newer function in MySQL:

http://www.mysql.com/doc/en/Fulltext_Search.html

Since MySQL 3.23.23. All you need is a fulltext index.

I am using, however, MySQL 4.0.5-beta-max-debug, but had the same problem in previous 
verisons. I have just never gottent his double quotes thing to work.

If I run the SQL in PHPMyAdmin, (a MySQL web interface), it works.

jdaxell.ccl = 2 records found.

SELECT id,AU,ST,BT,AT FROM ccl_main WHERE MATCH
(TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO)
AGAINST ('"ready maria"' IN BOOLEAN MODE)
ORDER BY id asc

But try to pass it through PHP - zippo. MySQL thinks it is a boolean search for
+ready +maria
not an exact search for the two words together
"ready maria"

MySQL does not see the double quotes. It should. Somehow, PHP is thwarting them?

This works:
http://ccl.flsh.usherb.ca/print/print.html?search=%26quot%3Bready+maria%26quot%3B
http://ccl.flsh.usherb.ca/print/display.test.inc.phps


This doesn't:
http://ccl.flsh.usherb.ca/print/index.html?search=%26quot%3Bready+maria%26quot%3B
http://ccl.flsh.usherb.ca/print/display.table.inc.phps

I've tried every combination of syntax I know. This should but doesn't do the trick:

$sql = 'SELECT id,AU,ST,BT,AT FROM '.$table.' WHERE MATCH 
(TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO)
AGAINST (\''.stripslashes($search).'\' IN BOOLEAN MODE) ORDER BY id asc';


John

Ray Hunter wrote:

> Which version of mysql are you using?
>
> --
> Ray
>
> On Wed, 2002-12-04 at 10:33, John Taylor-Johnston wrote:
> > Hi,
> >
> > Can someone take a look at this again, please?
> >
> > http://news.php.net/article.php?group=php.general&article=126934
> >
> > Your posts so far have proven fruitless. Thanks for trying. :) I do appreciate it.
> >
> > I will try to answer everyone at the same time.
> >
> > Someone mentionned it might be a problem with magic_quotes, but I didn't really 
>follow.
> >
> > http://news.php.net/article.php?group=php.general&article=126990
> >
> > I did test what he suggested:
> >
> > >From John Holmes
> > > try this
> >
> > Doesn't work. :) Thanks. I did try:
> >
> > $sql = "SELECT id,AU,ST,BT,AT FROM $table WHERE MATCH 
>(TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST ('".$search."' IN 
>BOOLEAN MODE) ORDER BY id asc";
> >
> > It echos:
> >
> > ('\"ready maria\"' IN BOOLEAN MODE)
> >
> > It should echo:
> >
> > ('"ready maria"' IN BOOLEAN MODE)
> >
> > for it to work. But even if I add slashquotes, it won't do it.
> >
> > 
>--------------------------------------------------------------------------------------------------------------
> > >could you get the error message with mysql_error() and post it here?
> >
> > There is no error. I wish there was :) Thanks for trying.
> >
> > >Doesn't work - Resembles +ready +maria
> > >hmm - how do you get your string "ready maria"?
> >
> > <input name=search>
> >
> > >why '.$table.' and not '".$table."'
> > >with what you've got now, I believe you are looking for table name.
> >
> > Good idea. Done that. Doesn't change . :) Thanks.
> >
> > >also, use double quotes for start and end of variables as in:
> > >$sql="select * from '".$table."' where var='some
> > >value other than a number' ";
> >
> > Doesn't work. :) Thanks.
> >
> > John

--
John Taylor-Johnston
-----------------------------------------------------------------------------
"If it's not open-source, it's Murphy's Law."

  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   -     Université de Sherbrooke:
          http://compcanlit.ca/
          819-569-2064



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to