Hi,
I have set up a MySQL database (MySQL 4.1) which is encoded in UTF-8
with the utf8_general_ci collation. Inserted into the database is some
Japanese dictionary information.
Now I'd like to querie my database from within a PHP5 script. I have a
webform where the user inputs the Japanese data that needs to be queried
(webpage uses UTF-8 encoding). In my script I tell the database that I'm
sending unicode data: $db->query("SET NAMES 'utf8'");
Then I construct a query that looks like:
SELECT * FROM EDICT WHERE KANA=$term
The variable term contains the user inputted utf-8 data. However, this
query does not work. It gives zero results (and I've made sure that the
requested data is actually in the database).
The data in $term seems correct (it displays correctly when I echo the
variable).
What am I missing here?