: г???????????? ?? ????????
Рісѓрїр°ріс<рір°с<рір°рї不能插入俄語文本到MySQL數據庫
所以,我有兩個頁面:registration.php和addUser.php。在它們中的每
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
數據庫包括11個表,每個表具有歸類:utf8_general_ci,類型:MyISAM數據。每個表中的每個字段都有整理:utf8_general_ci。
當我在phpMyAdmin直接寫入到數據庫,然後顯示此數據網頁。用英語和俄語 - 一切OK。
但是,當我吃飽了我的形式與registration.php的個人數據,然後將addUser.php - 顯示所有俄語字符,比如我寫上 - 網頁和數據庫了。
function AddNewUser($Name, $Surname, $FatherName, $Email, $Password, $Phone, $DegreeID, $RankID,
$Organization, $Department, $Country, $City, $Address, $Job)
{
//fetch data from database for dropdown lists
//connect to db or die)
$db = mysql_connect($GLOBALS["gl_kussdbName"], $GLOBALS["gl_kussUserName"], $GLOBALS["gl_kussPassword"]) or die ("Unable to connect");
//to prevenr ????? symbols in unicode - utf-8 coding
mysql_query("SET NAMES 'UTF8'");
//select database
mysql_select_db($GLOBALS["gl_kussDatabase"], $db);
$sql = "INSERT INTO UserDetails (
UserFirstName,
UserLastName,
UserFatherName,
UserEmail,
UserPassword,
UserPhone,
UserAcadDegreeID,
UserAcadRankID,
UserOrganization,
UserDepartment,
UserCountry,
UserCity,
UserAddress,
UserPosition)
VALUES(
'".$Name."',
'".$Surname."',
'".$FatherName."',
'".$Email."',
'".$Password."',
'".$Phone."',
'".$DegreeID."',
'".$RankID."',
'".$Organization."',
'".$Department."',
'".$Country."',
'".$City."',
'".$Address."',
'".$Job."'
);";
//execute SQL-query
$result = mysql_query($sql, $db);
if (!$result)
{
die('Invalid query: ' . mysql_error());
}
//close database = very inportant
mysql_close($db);
}
?>
有
也是這樣的信息在phpMyAdmin:
auto increment increment 1
auto increment offset 1
autocommit ON
automatic sp privileges ON
back log 50
basedir \usr\local\mysql-5.1\
big tables OFF
binlog cache size 32,768
binlog format STATEMENT
bulk insert buffer size 8,388,608
character set client utf8
(Global value) cp1251
character set connection utf8
(Global value) cp1251
character set database cp1251
character set filesystem binary
character set results utf8
(Global value) cp1251
character set server cp1251
character set system utf8
character sets dir \usr\local\mysql-5.1\share\charsets\
collation connection utf8_general_ci
(Global value) cp1251_general_ci
collation database cp1251_general_ci
collation server cp1251_general_ci
completion type 0
concurrent insert 1
所以我需要正確地顯示,保存,然後從數據庫俄文本。感謝名單! 連接超時10 datadir \ usr \ local \ mysql-5.1 \ data \
http://developer.loftdigital.com/blog/php-utf-8-cheatsheet – BalusC 2010-12-10 02:17:32
Thanx,BalusC !!你的回答是最好的幫助! – yozhik 2010-12-11 10:18:09