Get the App
SLTechnology News&Howtos  ›  Database  › 

The solution of phpMyAdmin MySQL garbled code under PHP

Shulou Source: shulou.com Published: 2022-06-01 00:09:00 11月02日 Update

This article will explain in detail the solutions to phpMyAdmin MySQL garbled under PHP. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

The solution to phpMyAdmin MySQL garbled under PHP: first encode the web page file head, then save it with [utf-8] encoding, then set the database related fields to [utf-8_general_ci], and finally add the relevant code when PHP connects to the database.

Solutions to phpMyAdmin MySQL garbled codes under PHP:

1. Head setting encoding of web page files

2. PHP pages are saved with utf-8 encoding and can be converted by notepad++ or other text editing software.

Notepad++ action: menu "format"-> "convert to UTF-8 encoding format"

3. The "sorting" of the fields in the database table is set to utf-8_general_ci.

4. Join when PHP connects to the database, that is, after mysql_connect ()

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")

Note that it is utf8, not utf-8.

This is the end of this article on "the solution to phpMyAdmin MySQL garbled under PHP". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.

Tags: Data database code garbled time article utf-8 method method field file more format web page good practical that is code content text Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Xiaomi Linux Shulou Information Microsoft