In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly describes how to solve php read database Chinese garbled code problem, the text is very detailed, has a certain reference value, interested friends must read!
php read database Chinese garbled solution: 1, open the corresponding PHP read database code file;2, add "mysql_query("set names 'utf8'");"code can be.
Operating environment: Windows 7 system, PHP 7.1 version, DELL G3 computer
How to solve php read database Chinese garbled problem?
PHP read-write database appears Chinese garbled code problem
When I read and write database in PHP, Chinese garbled code appears. Solution:
Just add one sentence:
mysql_query("set character set 'utf8'");//read library mysql_query("set names 'utf8'");//write library //actually reading and writing can only be added mysql_query("set names 'utf8'");
If you use mysqli, it is actually the same statement, but the main thing to note is that you must not write the character set as UTF-8, which is not available in PHP syntax.
The mysql_query() function executes a MySQL query.
syntax
mysql_query(query,connection)
parameters
Query is required. Specify the SQL query to send. Note: Query strings should not end with semicolons.
Connection is optional. Specify SQL connection identifiers. If not specified, the last open connection is used.
description
If there are no open connections, this function attempts to call mysql_connect() without arguments to establish a connection and use it.
return value
mysql_query() returns a resource identifier only for SELECT, SHOW, EXPLAIN, or DESCRIBE statements, or FALSE if the query executes incorrectly.
For other types of SQL statements, mysql_query() returns TRUE on success and FALSE on error.
A return value other than FALSE means that the query is valid and can be executed by the server. This does not say anything about the number of rows affected or returned. It is possible that a query executes successfully but does not affect or return any rows.
The above is "how to solve php read database Chinese garbled problem" all the content of this article, thank you for reading! Hope to share the content to help everyone, more relevant knowledge, welcome to pay attention to the industry information channel!
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.