Ask me to insert Chinese characters to MYSQL, but phpmyadmin is blank. what should I do? Ask me to insert Chinese characters to MYSQL, but the corresponding field of phpmyadmin is blank. what should I do?
Reply to discussion (solution)
Where to insert it?
The problem is not clearly stated
Check whether the variable name is wrong.
The problem is not clear enough. It may not be inserted at all. In addition, Chinese characters may be encoded and cannot be displayed.
Sorry, I didn't make it clear.
I am using a method written in PHP to execute the insert command.
Function newreader ($ name, $ pass, $ email)
{
// $ Str = "insert into reader ('name', 'password') VALUES (" '. $ name. "'," '. $ pass ."')";
$ Str = "insert into reader (name, password, email) values ('". $ name. "','". $ pass. "','". $ email. "')";
// Var_dump ($ str );
Try
{
Mysql_query ($ str );
}
Catch (Exception $ e)
{
Var_dump ($ e );
}
}
However, after the execution, we can see in MYSQL that if the inserted name is Chinese, it will not be blank or question mark (?) in the database (?)
The character set of the database uses: UTF-8 Unicode (utf8)
Connection proofreader selected: UTF-8_general_ci
My webpage has also been set:
Mysql_query ("set names utf8 ");
What should I do if I can insert Chinese characters? Thank you.
If the English and numbers are inserted normally, but the Chinese language is abnormal, it is the encoding problem. convert the encoding.