# Recommended: "Solution to php inserting garbled data: First, set the character set of the data table to utf8; then modify the character set format; then create a database with a character set of utf-8; and finally insert data through the php mysql statement. Can.
PHP Video Tutorial》
Solution to the problem of garbled characters in mysql databaseWhat we are most afraid of when using the database (mysql) is that the Chinese characters in the database are garbled, and Baidu in addition to changing the characters in the configuration file There doesn't seem to be any other constructive methods. What's more important is that I have tried all these methods one by one, and they don't seem to solve the problem. Then I will provide you with a more practical method that I have been using. Because I am learning PHP development, the methods I mentioned can all be used in PHP code. I have not tried it in other programming languages, but the commands to operate the MySQL database are all the same, so it should It can also be used. I will talk about the method I mentioned below.
By show create table data table name; viewing the table structure we can see that its character set is latin1
Looking at the table structure, you can see that the character set of the table is utf8
The above is the detailed content of How to solve the problem of garbled data inserted in php. For more information, please follow other related articles on the PHP Chinese website!