Solution to phpMyAdmin MySQL garbled code under PHP: First set the encoding for the web page file head; then use [utf-8] encoding to save when saving; then set the database related fields to [utf-8_general_ci]; finally Just add the relevant code when connecting to the database in PHP.
Solution to phpMyAdmin MySQL garbled code under PHP:
1. Web page file head setting encoding
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
2. The PHP page is saved using utf-8
encoding when saving, and can be converted using notepad or other text editing software.
notepad operation: menu "Format" -> "Convert to UTF-8 encoding format"
3. The "Organization" of the fields in the database table is set to utf-8_general_ci
4. When connecting to the database in PHP, that is, add . Note that it is utf8, not utf-8. Related tutorial recommendations: phpmyadmin The above is the detailed content of What should I do if phpMyAdmin MySQL is garbled under PHP?. For more information, please follow other related articles on the PHP Chinese website!mysql_query("set names ’utf8’ ");
mysql_query("set character_set_client=utf8");
mysql_query("set character_set_results=utf8");mysql_query("set character_set_connection=utf8");