Home >Backend Development >PHP Tutorial >Solution to garbled code in php connection to mysql_PHP tutorial

Solution to garbled code in php connection to mysql_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:31:38857browse

The most common reason for garbled characters is to directly connect to the mysql database tutorial without setting the encoding for the connection query. The commonly used method is mysql_query (set names gb2312), which can mostly be solved. Let’s look at one of the above methods to solve it

$link = mysql_connect('localhost','root',''); mysql_query("set character_set_connetion=utf8,character_set_result=utf8, character_set_client=binary",$link);

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/762037.htmlTechArticleIt is common for garbled characters to be directly connected to the mysql database tutorial without setting the encoding for the connection query. The commonly used one is mysql_query( set names gb2312) This can mostly be solved, see below...
Statement:
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