Home >Backend Development >PHP Tutorial >PHP character garbled,charactergarbled_PHP教程
Garbled characters appear during MySql console query
The character set of Database&Table is different from the character set displayed on the Mysql console
Right-click the mysql console border and click Properties to check whether the character set mode of the current code page is the same as the character set mode of the database
View database character set show variables like '%char%';
The main things to look at are: character-set-client=gbk character-set-server=gbk character-set-result=gbk Is it the same
Solution: Set database character mode
alert database Database_name default character set gbk;
alert database Database_name default character set utf8 default collate utf8_geberal_ci;
collate utf8_geberal_ci: utf8 character collation mode gbk did not find the collation, please leave a message.
If it doesn’t work, please open my.ini and modify default-character-set=gbk character-set-server=gbk
Specify when creating:
create database Database_name character set gbk;
The page is garbled: Find the page properties on Dreamware and set the character mode
If there is a link to Mysql, it should be unified
Database page character set HTML head Mysql to PHP link character (set names gbk)
What I get when querying the database on the page is garbled characters: Mysql, page character set, are mysql and PHP transmission characters the same
Set apache configuration file httpd.conf Add or modify apache default character startup mode: AddDefaultchars gbk
Set the transmission characters directly mysql> set names gbk
mysql_query("set names gbk",$conn);
mysql_close();
?>