Home  >  Article  >  Backend Development  >  phpmyadmin Chinese garbled code

phpmyadmin Chinese garbled code

王林
王林Original
2019-10-18 13:51:513387browse

phpmyadmin Chinese garbled code

1. First, find the table you created in phpMyAdmin, such as table1 (note that the table is not a database), click "Structure" above, and find the column in which you want to save Chinese Name, such as information, click "Modify" on the right and change the sorting rule to utf8_general_ci.

PS: If you build this table first, and then modify the sorting rules of the table or the sorting rules of the external database or even the server rules according to the tutorials mentioned on the Internet, you still cannot insert Chinese characters. , it must be accurate to this field, and if you set the character set when creating the table, there is no problem.

2. Add

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

to the head part of the html part of the page that is displayed after you run it, as shown below:

phpmyadmin Chinese garbled code

##3 . In the php part, before you insert the code into the database, add

mysql_query("set names &#39;utf8&#39;");

as shown in the picture:

phpmyadmin Chinese garbled code

Rerun the program and you can insert Chinese.

Recommended tutorial:

PHP video tutorial

The above is the detailed content of phpmyadmin Chinese garbled code. 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