• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 274
  • Last Modified:

In a PHP script, I execute a mysql SELECT query to find a word with the letter "é" in it, but it doesnt return the row. (it exists)

I am using  
$result = mysqlQuery('SELECT name FROM `titles` WHERE name = "général" ');
in a PHP script.

mysqlQuery() is my own wrapper for executing queries, it works.

There's a record général in the table, when I use phpMyAdmin and execute the same query, it can find the row. But in the php script it doesnt return anything.  I assume it has something to do with the encoding?

MySQL is utf8_unicode_ci
  • 2
1 Solution
try this:

$conn = mysql_connect('host', 'user', 'password');
Are you sure the file you use is encoded in utf8 and not in iso?
OctalysAuthor Commented:
Hi, I already tried mysql_set_charset already didnt change anything.

            $text = mb_convert_encoding($text, 'UTF-8', 'UTF-8');

didnt change anything either.
OctalysAuthor Commented:
Ok found the answer, it was mysql_set_charset that was giving me some weird problems. Rewrote it and suddenly it works.

I did a mysql query SET NAMES 'utf8' first and it worked, so I knew it was mysql_set_charset that wasnt working properly.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now