Error MySQL characters invalid?

1

I'm using this query to search the database:

SELECT * FROM cidades WHERE cidade LIKE ? LIMIT 1

In placeholder I used "Narnia"

And I received this error:

General error: 1267 Illegal mix of collations (utf8_bin,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE) for operation 'like' trace

How to solve this?

    
asked by anonymous 19.09.2016 / 06:39

1 answer

1

The LIKE operator needs other information - called wildcards - in its placeholder to understand what to do, such as % . >

Then try something like this:

SELECT * FROM cidades WHERE cidade LIKE '%Nárnia%' LIMIT 1

I do not know what technology you are using to replace the placeholder then it should look something like this:

SELECT * FROM cidades WHERE cidade LIKE '%?%' LIMIT 1

Comment here the right way to do it, and tell me the technology you're using, please.

    
19.09.2016 / 09:28