Home>Article>Backend Development> The php statement contains Chinese and cannot be queried

The php statement contains Chinese and cannot be queried

angryTom
angryTom Original
2019-10-26 16:08:16 2663browse

The php statement contains Chinese and cannot be queried

php statement contains Chinese and cannot be queried

We use PHP to view database data, but Chinese cannot be used. This problem is related to Our encoding format is related to the character format of the database and the page format. These formats must be the same and are all set to UTF-8. The following are the detailed steps to solve:

1. Check first The encoding format of the MYSQL database, then we first find the installation directory of the MYSQL data and find the my.ini file:

The php statement contains Chinese and cannot be queried

## 2. Open the my.ini file : Find the default-character-set and set it to utf8. There are 2 places to set in total

The php statement contains Chinese and cannot be queried

3. Then restart the MYSQL data and find Inside the service

The php statement contains Chinese and cannot be queried

4. Then set the encoding format of our web page to UTF-8

The php statement contains Chinese and cannot be queried

5. Set it in the PHP file and set it to utf8

mysql_query("set names 'utf8'");

The php statement contains Chinese and cannot be queried

For more PHP related knowledge, please visit

PHP中文网!

The above is the detailed content of The php statement contains Chinese and cannot be queried. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn