Write it down first, so that you don’t have to remember it and look for it everywhere later!
When PHP operates the database, the data in the database uses UTF8 encoding. When it is read out, all that is displayed is ???????question marks and garbled characters. I found some The data is originally encoded before reading:
Copy code The code is as follows:
create table tablename
(
id int not null auto_increment,
title varchar(20) not null,
contnet varchar (300) defalut null,
primary key ('id')
)begin=MyISAM DEFAULT CHARSET =UTF8;
Copy code The code is as follows:
mysql_query(" SET NAMES utf8");
Copy the code The code is as follows:
mysql_query("SET NAMES utf8");
The above introduces the php mysql PHP MYSQL garbled problem, using SET NAMES utf8 correction, including the content of php mysql. I hope it will be helpful to friends who are interested in PHP tutorials.