Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of reading Chinese garbled codes in database by php

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "how to solve the problem of php reading Chinese garbled code in the database". The content of the explanation in the article is simple and clear, and it is easy to learn and understand. below, please follow the editor's train of thought to slowly deepen, together to study and learn how to solve the problem of php reading Chinese garbled in the database.

1. Open the corresponding PHP to read the code file of the database.

2. Add "mysql_query (" set names' utf8' ");" code.

Mysql_query ("set character set 'utf8'"); / / read library mysql_query ("set names' utf8'"); / / write library / / actually both read and write can only join mysql_query ("set names' utf8'")

If you use mysqli, it's 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 found in PHP syntax.

The mysql_query () function executes a MySQL query.

Grammar

Mysql_query (query,connection)

Parameters.

Query is required. Specifies the SQL query to be sent. Note: the query string should not end with a semicolon.

Connection is optional. Specifies the SQL connection identifier. If not specified, the last open connection is used.

Thank you for your reading, the above is the content of "how to solve the problem of php reading Chinese garbled code in the database". After the study of this article, I believe you have a deeper understanding of how to solve the problem of reading Chinese garbled code in php database, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report