Re: Whimper, help :)
| From: | 1LT John W. Holmes | Date: | Wed, 04 Dec 2002 15:19:38 +0000 |
| Subject: | Re: Whimper, help :) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-126990@lists.php.net to get a copy of this message | ||
[snip]
> As far as I can see, *none* of these produce an identical query string to
> your hard-coded version -- they *all* have the double-quotes around the
> search string missing!
The double quotes are in $search, that's why. And the stripslashes is there
more than likely because of magic_quotes_gpc, which will make $search equal
to \"ready maria\"
What if you do it this way?
$search = '"ready maria"';
$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";
Does that work?
Are you sure the quotes you enter in the box aren't being converted to
" or %XX or something, and then causing your query to fail or return
odd results?
---John Holmes...
> Try this:
>
> $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';
>
> (BTW, I'm not sure you need the stripslashes() -- I don't use MySQL, so I
> can't be sure, but doesn't it need quotes to be backslash-escaped inside a
> quoted string?)
>
> Cheers!
>
> Mike
>
> ---------------------------------------------------------------------
> Mike Ford, Electronic Information Services Adviser,
> Learning Support Services, Learning & Information Services,
> JG125, James Graham Building, Leeds Metropolitan University,
> Beckett Park, LEEDS, LS6 3QS, United Kingdom
> Email: m.ford@lmu.ac.uk
> Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>