In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail the solution to the garbled code in php introduced into sql. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
The solution to the garbled code when php is introduced into sql is as follows: 1. Modify the character set to utf8;2 in the encoding of php, and execute the statement "convert to character set utf8; of the name of the alter table table".
This article operating environment: Windows7 system, PHP7.4 version, Dell G3 computer.
What if the garbled code in php is passed into sql?
About the php transmitted to the database Chinese garbled appear? The problem
First of all, if you look at the picture, it is wrong in the front and corrected in the back.
1. Modify the character set in the php encoding
Header ("Content-Type: text/html; charset=utf-8"); / / one place $link = @ mysql_connect ("localhost", "root", "root") or die ("hint: database connection failed!") ; mysql_query ('SET NAMES UTF8'); / / two places, remember that utf8 is not utf-8mysql_select_db ("test", $link)
two。 Use editing software to see if the php file is encoded by utf-8
3. If you have not done the above two steps successfully, you should consider the problem of the character set of the table in the database. Sure enough, my mistake is to make an error in the character set of the table. Execute the following statement
The name of the alter table table, convert to character set utf8;, is the end of this article on "the solution of garbled codes in php into sql". 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.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.