Home > Database > phpMyAdmin > body text

What should I do if phpMyAdmin MySQL is garbled under PHP?

coldplay.xixi
Release: 2020-07-20 13:54:33
Original
2065 people have browsed it

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.

What should I do if phpMyAdmin MySQL is garbled under 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" />
Copy after login

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

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");
Copy after login
after mysql_connect()

. 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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!