RE: Re[2]: [PHP] php query for mysql table

From: Date: Mon, 20 Aug 2001 10:56:51 +0000
Subject: RE: Re[2]: [PHP] php query for mysql table
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-63488@lists.php.net to get a copy of this message
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:madmax@mip.sdu.dk] Sent: 20. elokuuta 2001 13:47 To: php-general@lists.php.net 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: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#63488) next »