Re: AND OR NOT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



John Taylor-Johnston wrote:

> Any ideas? Post kind of lost in there since Saturday. Is str_replace the
> best choice for case sensitive and for swapping " AND "?
> 
>> <input TYPE="text" NAME="searchenquiry" VALUE="" size=30>
>>
>> Any suggestion on how to swap AND OR NOT for mysql fulltext syntax in
>> $searchenquiry?
>> A simple parse for " AND " and then str_replace? Is str_replace
>> appropriate for case?
> 
> John

I think you have a slightly more complex situation than just replacing text
between what I assume is a LIKE or multiple WHERE situation and a fulltext
search. Perhaps if you can give an idea of the type of string you are
likely to get in $searchenquiry, and to what you wish to convert it, we
might be better placed to give advice.

I can envisage that you might get 'bananas NOT pears AND apples' in the
variable; I guess you would currently manipulate that to a query such as
 
"WHERE x = 'bananas' AND x <> 'pears' AND x = 'apples'"

(OK that's not a good example) but if you were to feed that to a fulltext
search you might want

WHERE MATCH (x) AGAINST ('+bananas -pears -apples' IN BOOLEAN MODE)

or maybe something else depending on the version of Mysql and exactly what
you are trying to do with your fulltext search.




Cheers
-- 
David Robley

Why do cats have canine teeth?

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux