The following small series will provide you with a quick solution to read MYSQL Chinese garbled characters in PHP. I think this is quite good. now I will share it with you and give you a reference. Let's take a look at the host of a website. I didn't expect Php and Mysql Chinese garbled characters.
In the past, Mysql for foreign hosts was 4. x series, I feel better, no matter GBK and UTF-8 are not garbled, did not expect the new host Mysql is 5.0 version, after importing data, read out with Php is question mark, garbled text. I remember that I had a previous experience with garbled text during switching. the reason must be the difference between Mysql versions.
I had to check the information and found a solution. I added a set names UTF8 sentence after mysql_connect to eliminate garbled characters in the UTF8 database. for GBK databases, I used SET NAMES GBK, the code is as follows:
$ Mysql_mylink = mysql_connect ($ mysql_host, $ mysql_user, $ mysql_pass); mysql_query ("set names 'gbk '");
The above is all the content of the quick solution for PHP to read MYSQL Chinese garbled characters. I hope it will be helpful to you and support PHP Chinese network a lot ~
For more articles about how PHP can quickly read MYSQL Chinese garbled characters, refer to PHP Chinese network!