vinoth1986 — 2010-03-29T04:33:08-04:00 — #1
I have created mysql table which has a text field, varchar and both are in utf-8 format. But When I do select query with where condition it returns empty result set even it has a value.
I make the field as utf-8 format, table as utf-8 format. What should I do for this problem
guelphdad — 2010-03-29T12:39:30-04:00 — #2
are you using the mysql client or a GUI for this or are you using a front end like PHP and perhaps introducing the error there?
vinoth1986 — 2010-03-30T00:33:48-04:00 — #3
I'm using php it doesn't show any error message. It just return an empty string.
crmalibu — 2010-03-30T11:35:06-04:00 — #4
Most likely, one of the values(either value in db, or val in the sql query) is not really utf8, or it may have some additional characters that you can't visually detect.
Take a close look at the values. This should help make the difference more obvious.
select HEX(name), HEX('$name'),
guelphdad — 2010-03-30T11:37:14-04:00 — #5
are you using phpmyadmin or php in a script? if the latter, what error checking? Do you have access to the mysql client to check if your query should return rows?
can you show some sample rows in the table, which of those rows should be returned by the query and the query itself?
spacephoenix — 2010-03-30T14:46:00-04:00 — #6
If you are using php to connect to MySQL, right after you establish a connection to the MySQL server but before you select a database if using the mysql_* extension:
if using the mysqli_* extension:
That will tell PHP what character set you wish to use for the connection to the MySQL server.