fatkatie Posted February 16, 2017 Share Posted February 16, 2017 Still new. Off topic - not really php? Hope not. Who else knows mysql like the php crowd. I find this clause construct in many places on this new site: and t2.keyword like concat('%', :bc11, '%') or t2.name like concat('%', :bc12, '%') or t2.des like concat('%', :bc13, '%') He's trying to find the search term anywhere in any of the 3 fields. bc11, bc12 and bc13 are binding 'keys' that receive identical values. Is there a way to build this something like this:? and any (t2.keyword, t2.name, t2.des) like concat('%', :bc11, '%') I had to make up something my self :-). Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/303210-mysql-construct-to-apply-multiple-fields-to-a-single-like/ Share on other sites More sharing options...
ginerjm Posted February 16, 2017 Share Posted February 16, 2017 I don't you can concat substitute parms. But you can make the values behind those parms work by concatenating the % to the values you assign to those parms. Quote Link to comment https://forums.phpfreaks.com/topic/303210-mysql-construct-to-apply-multiple-fields-to-a-single-like/#findComment-1542865 Share on other sites More sharing options...
Barand Posted February 16, 2017 Share Posted February 16, 2017 If you are doing wildcard searches, using LIKE, you are stuck with the long version I'm afraid. Alternative is FULLTEXT index search. (Moving to MySql forum) Quote Link to comment https://forums.phpfreaks.com/topic/303210-mysql-construct-to-apply-multiple-fields-to-a-single-like/#findComment-1542868 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.