I have this scenario:
I have a mysql database, with a table that contain strings.
I send a string through a post/get/whatever request to a script that must check if a string from the table is contained into the sent string.
For example I have the word “test” in the table and I send the word “atesta”. I want to return true.
The other way around (check if the word is contained inside the database) is simple (select bla bla where column like “%string%”).
I hope my way of describing the problem is clear enough.
Reverse the arguments. Then use the the concatenation operator
||to add the%, front and back:or the concatenation function:
I should mention that default settings have the
||operator act as a synonym for logicalORoperator. To act as the standard concatenation operator, the server has to run inANSImode (read about thePIPES_AS_CONCATdetail).