In the use of PHP (as the current mainstream development language) 5, through the MySQL (and PHP collocation of the best combination) to get the value of all become???????, the original character set is wrong.
I am installing MySQL (and the best combination of PHP) 5 o'clock, has chosen the default character set of gb2312, but still return garbled, the solution is to connect MySQL (and the best combination of PHP) server, a set of the same set of characters called "Set names X" statement (x For the character set you have set). Here is my connection function:
function Sql_connect () {
Global $MySQL (best combination with PHP) _host, $MySQL (best combination with PHP) _user, $MySQL (best combination with PHP) _password, $MySQL (best combination with PHP) _ DATABASE;
$connection = @MySQL (best combination with PHP) _connect ($MySQL (best combination with PHP) _host, $MySQL (best combination with PHP) _user, $MySQL (best combination with PHP) _ PASSWORD) or Startuperror (
Could not connect to MySQL (the best combination of PHP collocation) database.
, Connect Error);
if (! MySQL (best combination with PHP) _select_db ($MySQL (and PHP collocation) _database))
{
Includeinstall.php (as the current mainstream development language);
DoInstall ();
MySQL (and PHP collocation best combination) _select_db ($MySQL (and PHP collocation of the best combination) _database) or Startuperror (
Could not select database:. MySQL (and PHP collocation of the best combination) _error ().
, Connect Error);
}
Sql_query (Set names "gb2312"); Sql_query is a custom Execute query function, the key is this statement
return $connection;
}
http://www.bkjia.com/PHPjc/508723.html www.bkjia.com true http://www.bkjia.com/PHPjc/508723.html techarticle in the use of PHP (as the current mainstream development language) 5, through the MySQL (and PHP collocation of the best combination) to get the value of all become???????, the original character set is wrong. I'm in Ann .