Home > Article > Backend Development > PHP connection mysql garbled solution_PHP tutorial
php tutorial connection mysql tutorial garbled solution
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 a solution that cannot be solved by the above method. Processing methods.
$link = mysql_connect('localhost','root','');
mysql_query("set character_set_connetion=utf8,character_set_result=utf8, character_set_client=binary",$link);