Skip to content
Advertisement

utf8_encode difference between result in SQL and PHP

I’m using utf8_encode to make sure that the input from my users is transforming the special characters to a character where my MYSQL can do a search on. (My database is set in latin1_swedish.ci).

When I echo my query, I get a perfect query that I can run against my MYSQL (and I get an result). But when I do the same query via my PHP it doesn’t work.

JavaScript

Advertisement

Answer

I found a (easy) fix. I removed the utf8_encode and placed the following meta tag in the head of my body.

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement