This article mainly describes the actual solution of PHP + MYSQL garbled characters in actual operations, if you encounter character disorder in PHP + MYSQL operations, the main solution is as follows:
Add a set names UTF8 clause after mysql_connect to eliminate garbled characters in the UTF8 database. set names gbk is used for GBK databases. The Code is as follows:
- $ Mysql_mylink = mysql_connect ($ mysql_host, $ mysql_user, $ mysql_pass );
- Mysql_query ("set names 'gbk '");
The database character set is UTF-8.
The connection statement uses this
- Mysql_query ("set names 'utf8 '");
- Mysql_query ("set character set UTF8 ");
- Mysql_query ("SET CHARACTER_SET_RESULTS = utf8 '");
The above content is a description of the solution to PHP + MYSQL garbled code. I hope it will help you in this regard.
The above content is a description of the solution to PHP + MYSQL garbled code. I hope it will help you in this regard.