PHP5.2+MYSQL5.1+APACHE2.29+WINDOW2000 IE6,firefor2,firefox3
PHP网页向MYSQL数据库插入记录时出现如下问题。
Illegal mix of collations (gbk_chinese_ci,IMPLICIT) and (latin1_swedish_ci,COERCIBLE) for operation '=' ????????????
解决方法:1.注意PHP网站 charset=UTF-8"
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
2.数据库连接设置为 utf8编码
<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_member = "localhost";
$database_member = "member";
$username_member = "root";
$password_member = "123456";
$member = mysql_pconnect($hostname_member, $username_member, $password_member) or trigger_error(mysql_error(),E_USER_ERROR);
mysql_query("set names gbk");
?>
请修改为 mysql_query("set names utf8");
中文问题花去一天时间,请注意php和MYSQL编码发送相同问题。与MYSQL数据库编码无关
有问题联系steven_roc@126.com