i'm doin this offlist -----Original Message----- From: Ralph Guzman [mailto:[EMAIL PROTECTED] Sent: Thursday, September 04, 2003 10:23 PM To: PHP General Mailing List Subject: [PHP] mysql Pattern Matching
I know this question is best for the mySQL mailing list, but I am unable to subscribe to their list at this moment so perhaps somebody here can help me out. I have a table with a field where amenities are listed together using a comma delimiter like: pool,spa,fitness-center To search this table I use a query that looks something like this: SELECT * FROM properties WHERE amenities LIKE '%pool%' AND amenities LIKE '%spa%' AND amenities LIKE '%fitness-center%' This works, however let's say the user chooses to search for more amenities. This means the query would need multiple 'AND amenities LIKE '%____%' statements. Is there a better way to write this? I tried the following, but it did not work: AND amenities LIKE ('%pool%','%spa%','%fitness-center%') Any suggestions? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php