Wamp + PHP is a simple message function. if you enter Chinese characters on the webpage, the database becomes garbled. for help !!!!! This is the page and link database code: & lt; head & gt; & lt; metahttp-equiv & quot; Content-Type & quot; content & quot; texthtml; charsetUTF-8 & quot; & gt; & lt ;? Php & wamp + PHP problems
A simple message function allows you to enter Chinese characters on the webpage, and garbled characters are displayed in the database for help !!!!!
Here is the page and link database code:
Include ('Conn. php ');
If ($ _ POST ['sub']) {
$ Ghj = "insert into message (id, user, title, content, lastdate )".
"Value ('', '$ _ POST [user]', '$ _ POST [title]', '$ _ POST [content]', now ())";
Mysql_query ($ ghj );
Echo "successful ";
}
?>
This is the conn. php file code:
$ Conn = @ mysql_connect ("localhost", "root ","");
Mysql_select_db ("new", $ conn );
Mysql_query ("set names 'gbk'"); // use GBK Chinese encoding;
?>
------ Solution --------------------
Mysql_query ("set names 'gbk '");
Do you think it is appropriate?
------ Solution --------------------
Mysql_query ("set names 'gbk'"); // use GBK Chinese encoding;
The page encoding must be consistent with the database encoding.
------ Solution --------------------
We recommend that you use the encoding in your database. You can unify the two ..