I have an image gallery database setup where I take the users input and split it up on the spaces using the explode() function. I then loop through the array that is created by doing that and create the search term.
I also give the users the option to search using the AND or OR operators. Depending on what they choose the search string will be either: And = ...where title='me' and title='myself' and title='irene' Or = ... where title='me' or title='myself' or title='irene' Doing it this way, you'd probably want to filter out things like the ampersand and other characters that could mess with the search. Hopefully this points you in the right direction... Conor -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Jer Sent: Tuesday, April 26, 2005 10:18 AM To: [email protected] Subject: [php_mysql] Search with LIKE too restrictive Currently, I use LIKE in the query (i.e. WHERE title LIKE '$search'). I'm finding that that is too restrictive. For example, if someone were to search for the title "Me, Myself & Irene", they would actually need to search for "me, myself & irene". If they search for "me myself irene" or "me irene" or "me, myself and irene", the search would come back with nothing. Is there a better way to search than using LIKE in the query? The PHP_mySQL group is dedicated to learn more about the PHP_mySQL web database possibilities through group learning. Yahoo! Groups Links The PHP_mySQL group is dedicated to learn more about the PHP_mySQL web database possibilities through group learning. Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/php_mysql/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
