bschultz Posted January 21, 2012 Share Posted January 21, 2012 I'm trying to write a select to match a few certain words... $sql = "SELECT * FROM podcasts WHERE `type` = 'podcast' AND recap LIKE 'Men%' AND recap LIKE '%Hockey%' ORDER BY date DESC"; That's what I have so far...which isn't working... I need to match the string "Mens" OR "Men's" with the word "Hockey" BUT...I can't match "Women's" or "Womens" Any idea what I'm doing wrong? The above code only returns 6 results...when it should return nearly 100. Thanks! Link to comment https://forums.phpfreaks.com/topic/255461-php-to-select-like/ Share on other sites More sharing options...
bschultz Posted January 21, 2012 Author Share Posted January 21, 2012 I got it... $sql = "SELECT * FROM podcasts WHERE `type` = 'podcast' AND recap LIKE '% Men\'s Hockey%' OR recap LIKE '% Mens Hockey%' ORDER BY date DESC"; Link to comment https://forums.phpfreaks.com/topic/255461-php-to-select-like/#findComment-1309759 Share on other sites More sharing options...
Pikachu2000 Posted January 21, 2012 Share Posted January 21, 2012 mysql_real_escape_string Link to comment https://forums.phpfreaks.com/topic/255461-php-to-select-like/#findComment-1309842 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.