limitphp Posted January 21, 2009 Author Share Posted January 21, 2009 select * from artist where artistName = '$name' OR LIKE '%{$name} ' OR artistName LIKE ' {$name}%' Something like that may work. Actually I tried that exact query...only I changed the $name to es, and I added the artistname before the second OR (you forgot to put it in) and I got zero results. this is what I put: select * from artist where artistName = 'es' OR artistName LIKE '%{es} ' OR artistName LIKE ' {es}%' Quote Link to comment https://forums.phpfreaks.com/topic/141092-help-with-like-search/page/2/#findComment-742185 Share on other sites More sharing options...
revraz Posted January 21, 2009 Share Posted January 21, 2009 Dont use {} around es. Quote Link to comment https://forums.phpfreaks.com/topic/141092-help-with-like-search/page/2/#findComment-742189 Share on other sites More sharing options...
limitphp Posted January 21, 2009 Author Share Posted January 21, 2009 Dont use {} around es. OK...I tried it. Unfortunately it returned no results. select * from artist where artistName = 'es' OR artistName LIKE '%es ' OR artistName LIKE ' es%' Here's the problem: = 'es' only returns artistName that literally equals es.....no other words or spaces can be present. LIKE '%es ' only returns artistName that has a space (and only one space) after es. LIKE ' es%' only returns artistName that has a space (and only one space) before es. So, none of those conditions returned my entries of "ES Buzz" or "Through ES" LIKE doesn't seem like it can do matching, only LIKE. But I think the only way you can use Match xxx AGAINST xxx is if you use full index (which I'm not even sure what that is). I don't understand why MATCH would tax the system so much more than LIKE. I can't believe there is not a query that can return a result that contains the EXACT word or contains the EXACT word plus other words. Quote Link to comment https://forums.phpfreaks.com/topic/141092-help-with-like-search/page/2/#findComment-742240 Share on other sites More sharing options...
jjacquay712 Posted January 21, 2009 Share Posted January 21, 2009 select * from artist where artistName LIKE ' %es%' OR artistName LIKE '%es% ' try that Quote Link to comment https://forums.phpfreaks.com/topic/141092-help-with-like-search/page/2/#findComment-742393 Share on other sites More sharing options...
revraz Posted January 21, 2009 Share Posted January 21, 2009 Read the first few posts. select * from artist where artistName LIKE ' %es%' OR artistName LIKE '%es% ' try that Quote Link to comment https://forums.phpfreaks.com/topic/141092-help-with-like-search/page/2/#findComment-742414 Share on other sites More sharing options...
revraz Posted January 21, 2009 Share Posted January 21, 2009 You are asking for one search to do many things. You are asking for a Actual search "Watercolors" as well as asking for a Word match "ES" at the start or at the end. You can have 3 search screens if you want, Exact, Starts with, Ends with. Dont use {} around es. OK...I tried it. Unfortunately it returned no results. select * from artist where artistName = 'es' OR artistName LIKE '%es ' OR artistName LIKE ' es%' Here's the problem: = 'es' only returns artistName that literally equals es.....no other words or spaces can be present. LIKE '%es ' only returns artistName that has a space (and only one space) after es. LIKE ' es%' only returns artistName that has a space (and only one space) before es. So, none of those conditions returned my entries of "ES Buzz" or "Through ES" LIKE doesn't seem like it can do matching, only LIKE. But I think the only way you can use Match xxx AGAINST xxx is if you use full index (which I'm not even sure what that is). I don't understand why MATCH would tax the system so much more than LIKE. I can't believe there is not a query that can return a result that contains the EXACT word or contains the EXACT word plus other words. Quote Link to comment https://forums.phpfreaks.com/topic/141092-help-with-like-search/page/2/#findComment-742428 Share on other sites More sharing options...
limitphp Posted January 21, 2009 Author Share Posted January 21, 2009 You are asking for one search to do many things. You are asking for a Actual search "Watercolors" as well as asking for a Word match "ES" at the start or at the end. You can have 3 search screens if you want, Exact, Starts with, Ends with. Perhaps. I would assume most search engines operate this way. For instance...if a teacher were to search for "ESL", they don't want results that have ESL within a word....that would give them WAY TOO MANY irrelevant results. Quote Link to comment https://forums.phpfreaks.com/topic/141092-help-with-like-search/page/2/#findComment-742487 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.