Questions about php garbled characters

Source: Internet
Author: User
New users ask php garbled questions. My mysql database, database, data table, field, connection proofread, are all UTF-8 encoding. Reg01.php submits Chinese data to reg02.php, echo & nbsp; what are garbled characters in SQL statements and stored in the database? Reg01.php has & lt; meta & nbsp; http-equiv = "Content-T. For more information, see php garbled text.
My mysql database, database, data table, field, connection proofread, are all UTF-8 encoding.
What if reg01.php submits Chinese data to reg02.php and echo SQL statements and stores them in the database?
Reg01.php has

图示如下:
1.mysql数据库,和数据库连接校对都是UTF-8编码


2.数据库,字段都是UTF-8编码



3.echo sql语句和存入数据库都是乱码



什么原因呢?好烦这个问题。 PHP 乱码 UTF-8 分享到:
------解决方案--------------------
从你最后一张贴图上看,你是在 gbk 编码的界面中输出 utf-8 编码的内容
------解决方案--------------------
插入sql前加上:mysql_query("set names utf8"); 应该就可以了

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.