Many of my friends may encounter garbled characters when they connect to the database for reading or writing at the early stage of learning PHP. Today, I am here to tell you the simplest way to solve the garbled problem by using phpmyadmin to add a mysql database, then use php operations database garbled solution: 1: confirm phpmyadmin mysql character set for utf-8unicode (utf8) "> <LINKhref
Many of my friends may encounter garbled characters when they connect to the database for reading or writing at the early stage of learning PHP. Today, I am here to tell you the simplest way to solve the garbled problem.
Use phpmyadmin to add a mysql database, and then use php to operate the database. The solution is garbled:
1: confirm that the mysql character set used by phpmyadmin is UTF-8 unicode (utf8), the mysql connection is utf8_general_ci, and the language is chinese-chinese simplified.
2: confirm that each data table is "utf8_general_ci;
3: add a statement after connecting to the mysql database in php to specify the character set of the database,
Example: $ conn = mysql_connect ("localhost", "root", "your password"); // connect to the database
Mysql_query ("set name 'utf8 '");