LeeMC1989 Posted July 11, 2011 Share Posted July 11, 2011 Hi, I'm wondering how I would select a column from the database when searched through a LIKE. example.. $text = 'BLAHSet Fire To The Rain'; $query = mysql_query("SELECT musictitle FROM music WHERE musictitle LIKE '%Set Fire To The Rain%%'") or die(mysql_error()); But its not fetching anything.. (I have tried a combination of %'s, _'s, and /'s) I also tried REGEXP.. Basicly I have a PHP file reading a RSS feed and what I want to do is search for each song name and and output the RSS with my info from database, but the RSS feed title displays as follows (1 Adele - Set Fire To The Rain) but the song title and artist are in the same title..? I can't figure it out.. Quote Link to comment https://forums.phpfreaks.com/topic/241664-how-do-i-search-within-a-column-mysql-like/ Share on other sites More sharing options...
gristoi Posted July 11, 2011 Share Posted July 11, 2011 why have you got two %% at the end of your query? try: $query = mysql_query("SELECT musictitle FROM music WHERE musictitle LIKE '%Set Fire To The Rain%'") or die(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/241664-how-do-i-search-within-a-column-mysql-like/#findComment-1241252 Share on other sites More sharing options...
fenway Posted July 13, 2011 Share Posted July 13, 2011 You're going to get burned on whitespace. Quote Link to comment https://forums.phpfreaks.com/topic/241664-how-do-i-search-within-a-column-mysql-like/#findComment-1242493 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.