Home > Backend Development > PHP Tutorial > Explanation on how to solve the problem of garbled characters in PHP connection to MySQL_PHP Tutorial

Explanation on how to solve the problem of garbled characters in PHP connection to MySQL_PHP Tutorial

WBOY
Release: 2016-07-13 17:40:34
Original
775 people have browsed it

In the early days of learning PHP, many friends will always have garbled characters when connecting to the database to read or write. Today I will tell you the simplest way to solve the garbled code problem

Use phpmyadmin to add the mysql database, and then use Solution to garbled characters in PHP operation database:
1: Confirm that the mysql character set used by phpmyadmin is utf-8 unicode (utf8); the mysql connection proofreading is utf8_general_ci, and the language is Chinese-chinese simplified
2: Confirm that each The data table is "organized into" utf8_general_ci;
3: Add a statement after php connects to the mysql database to specify the character set of the database,
For example: $conn=mysql_connect("localhost","root","you Password"); //Connect to the database
mysql_query("set name utf8");

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/486204.htmlTechArticleMany friends in the early days of learning PHP, there will always be garbled characters when connecting to the database to read or write. Today's editor Here I will tell you the simplest way to solve the problem of garbled characters using phpmyadmi...
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