$mysql_server_name=""; //数据库服务器名称
$mysql_username=""; // 连接数据库用户名
$mysql_password=""; // 连接数据库密码
$mysql_database=""; // 数据库的名字
$conn = mysql_connect($mysql_server_name, $mysql_username,$mysql_password);
if (!$conn)
{
echo "<script language=javascript>alert('连接远程服务器出错!');</script>";
exit;
}
mysql_select_db($mysql_database);
mysql_query("SET NAMES utf8");
mysql_query("SET CHARACTER SET utf8");
mysql_query("SET COLLATION_CONNECTION='utf8_general_ci'");
$strsql = 'select * from team_member';
$result = mysql_query($strsql, $conn);
while($row = mysql_fetch_row($result)){
}
================================
mysql_query("set names charset utf8")设置客户端字符集为UTF-8
mysql_query("set character set utf8")设置连接字符集
前者包含:client | result | connection
后者包影响的就:connection