Home >Backend Development >PHP Tutorial >PHP+MySQL5.0 Chinese garbled solution_PHP tutorial
I recently studied Apache2+PHP4.4.1+MySQL5.0, and the Chinese characters displayed on the page were all "???.....". I found a lot of information on the Internet and found a simple solution!
PHP script content for database connection:
config.inc.php
//Configure mysql database connection parameters
$db = mysql_connect(" localhost", "user","password");
mysql_select_db("message",$db);
//Add the following line before executing the sql statement
mysql_query("SET NAMES 'gb2312 '",$db);
?>