Home >Backend Development >PHP Tutorial >Solution to garbled code in php connection to mysql_PHP tutorial
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);