Tom,
Sorry for the delay. I have tried your code.

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

Without the space, as with addslashes, MySQL won't compute the sql.

This is the echo $sql. There is an extra space before the final single quote. 
Nonetheless,

$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 
(\''.clean_search_string($search).'\' IN BOOLEAN MODE) ORDER BY id asc';

MySQL still thinks it is receiving A boolean +ready and + maria
http://ccl.flsh.usherb.ca/print/index.html

I'm just dumbfounded.



> Tom Rogers wrote:

> Hi,
>
> Thursday, December 5, 2002, 3:39:20 AM, you wrote:
> JTJ> What are magic quotes? Will this help me?
>
> JTJ> http://news.php.net/article.php?group=php.general&article=126934
>
> JTJ> How is this different from stripslashes.
>
> JTJ> I have RTF doc :)
>
> JTJ> http://www.php.net/manual/en/function.get-magic-quotes-gpc.php
>
> JTJ> Be gentil ::p
>
> JTJ> --
> JTJ> John Taylor-Johnston
> JTJ> -----------------------------------------------------------------------------
> JTJ> "If it's not open-source, it's Murphy's Law."
>
> JTJ>    -     Université de Sherbrooke:
> JTJ>           http://compcanlit.ca/
>
> magic quotes are slashes that are added to post and get data by PHP
> That is probably what is stuffing up :)
> I replied to an earlier thread with a possible solution but here it is again...
>
> function clean_search_string($s){
>         $s = stripslashes($s);
>         $state = 'S';
>         $len = strlen($s);
>         $out = '';
>         $list = array();
>         for($i=0;$i<$len;$i++){
>                 switch($state){
>                         case 'S':
>                                 switch($s[$i]){
>                                         case ' ':
>                                         break;
>                                         case '"':
>                                                 $state = 'Q';
>                                         break;
>                                         case "'":
>                                                 $state = 'q';
>                                         break;
>                                         default:
>                                                 $state = 'W';
>                                                 $out .= $s[$i];
>                                         break;
>                                 }
>                         break;
>                         case 'W':
>                                 switch($s[$i]){
>                                         case ' ':
>                                                 $state = 'S';
>                                                 $out = addslashes($out);
>                                                 $list[] = $out;
>                                                 $out = '';
>                                         break;
>                                         default:
>                                                 $out .= $s[$i];
>                                         break;
>                                 }
>                         break;
>                         case 'Q':
>                                 switch($s[$i]){
>                                         case '"':
>                                                 $state = 'S';
>                                                 $out = '"'.addslashes($out).'"';
>                                                 $list[] = $out;
>                                                 $out = '';
>                                         break;
>                                         default:
>                                                 $out .= $s[$i];
>                                         break;
>                                 }
>                         break;
>                         case 'q':
>                                 switch($s[$i]){
>                                         case "'":
>                                                 $state = 'S';
>                                                 $out = '"'.addslashes($out).'"';
>                                                 $list[] = $out;
>                                                 $out = '';
>                                         break;
>                                         default:
>                                                 $out .= $s[$i];
>                                         break;
>                                 }
>                         break;
>                 }
>         }
>         if(!empty($out)) $list[] = addslashes($out);;
>         $r = '';
>         $x = 0;
>         while(list($key,$val)=each($list)){
>                 $r .= $val.' ';
>         }
>         return $r;
> }
> $test = addslashes(' +test "hello maria" fish '."-O'Brian 'big \" test'");
> $list = clean_search_string($test);
> echo $list.'<br>';
>
> you will then just need "SELECT.......... AGAINST '$list' ....  "
>
> --
> regards,
> Tom

--
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

Reply via email to