Home >
Backend Development >
PHP Tutorial >
Solution to the problem of Chinese characters being stored or displayed as garbled characters in php_PHP Tutorial
Solution to the problem of Chinese characters being stored or displayed as garbled characters in php_PHP Tutorial
WBOY
Release: 2016-07-21 15:39:20
Original
774 people have browsed it
In the future writing process, everyone must remember to define the character type. mysql_query("set names 'gbk'") The solution is that simple. Today I made a database query and released the code.
Copy code The code is as follows:
/* filename:query.php do:get and show the data author:www.5dkx.com */ include_once("conn.php"); include_once("include.php"); mysql_query("set names 'gbk'")or die("Failed to set character library n"); mysql_select_db($db)or die("Failed to connect to database!n"); $exec = " select * from $table"; //echo $exec; $result = mysql_query($exec,$conn)or die("Failed to query database n"); echo "
http://www.bkjia.com/PHPjc/321573.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/321573.htmlTechArticleEveryone must remember to define the character type in the future writing process. mysql_query("set names 'gbk'") The solution is that simple. I did a database query today and released the code...
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