The garbled code caused by encoding has been a lot of time. I do not know what went wrong. It is clear that the PHP file encoding is consistent with the MySQL encoding. However, the implanted data is indeed garbled Chinese characters. Adjustment
The results of multiple encodings are the same. In the end, this problem was solved by using mysql_query ("set names 'gbk.
Garbled characters are not declared
<?
$ Conn = @ mysql_connect ("127.0.0.1", "root", "") or die ("connection error"); // ip
Mysql_select_db ("www", $ conn );//
$ SQL = "insert into test (ID, uid, regdate, remark) values (null, 'Liu yife', now (), 'start ')";
Mysql_query ($ SQL, $ conn );
?>
Add: mysql_query ("set names 'gbk'"); solve the garbled Problem
<?
$ Conn = @ mysql_connect ("127.0.0.1", "root", "") or die ("connection error"); // ip
Mysql_select_db ("www", $ conn );//
Mysql_query ("set names 'gbk '");
$ SQL = "insert into test (ID, uid, regdate, remark) values (null, 'Liu yife', now (), 'start ')";
Mysql_query ($ SQL, $ conn );
?>
What I used to find on the Internet
Set names 'gbk'. I wrote an error and found it today as mysql_query ("set names 'gbk '").
Http://hi.baidu.com/laoshiaaa/blog/item/dea3256774896d2faa184c6e.html/cmtid/64aa46ac89442a064a36d67e