This can be solved by building a function to split users entry to pieces so
that the query will be like
"SELECT * FROM table WHERE Question LIKE '%word1%' || Question LIKE
'%word2%' || Question....."
if only one of the words have to match the Question field.


Niklas Lampén

-----Original Message-----
From: Morten Winkler Jřrgensen [mailto:[EMAIL PROTECTED]]
Sent: 20. elokuuta 2001 13:47
To: [EMAIL PROTECTED]
Subject: Re[2]: [PHP] php query for mysql table


Notice that if a user enters

"life anger"

in the search field

SELECT * FROM table WHERE question LIKE "%life anger%" none of the
questions

>> [1] How do you deal with anger?
>> [2] Ever been full of anger in your life?
>> [3] Is life always easy?

will match. For that you must split the query by " " and perform a

SELECT * FROM table WHERE question  LIKE "%life%" OR question LIKE
"%anger%"

or possibly change the OR with a AND.


Kind regards,
    Morten Winkler



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to