" to PHP; 2. Open the data and add "mysql_query("set names utf-8 ");"."/> " to PHP; 2. Open the data and add "mysql_query("set names utf-8 ");".">
Home >Backend Development >PHP Problem >What should I do if the PHP database cannot insert Chinese characters?
##The operating environment of this article: linux5.9.8 system, PHP7.1 version, Dell G3 computerSolution to the problem that Chinese cannot be inserted into the php database: 1. Add "f89a46a6a756f40d0e372e851e248fd7" to PHP; 2. Open the data and add " mysql_query("set names utf-8");".
What should I do if the php database cannot insert Chinese characters?
php mysql cannot insert Chinese characters
Write PHP today to operate the MySQL database The program displays a question mark when inserting Chinese characters, as shown below:| abcdef3233 | 123456 | abcdef3233@163.com | ????????? | 2011-12-25 10:22:47 |When directly operating the database under Linux, the display is normal. Later it was found that the page encoding and database encoding were inconsistent. Solution: Add to the PHP program:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">After opening the data, add:
mysql_query("set names utf-8");Of course, I use utf-8 encoding here. If you are using gb2312 Encoding, utf-8 needs to be changed accordingly. Problem solved. Recommended learning: "
PHP Video Tutorial"
The above is the detailed content of What should I do if the PHP database cannot insert Chinese characters?. For more information, please follow other related articles on the PHP Chinese website!