<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><!--这里很重要,得加上-->
<?php
//连接数据库
$con = mysql_connect("localhost","root","John_here"); //本机root John_here
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
//定位数据库
mysql_select_db("Tb3", $con); //数据库名为Tb3
//设置数据库查询编码
mysql_query("SET character_set_connection=utf8, character_set_results=utf8, character_set_client=binary", $con);
//执行查询语句
$result = mysql_query("SELECT * FROM os_users");
//显示数据
while($row = mysql_fetch_array($result))
{
echo $row[0] . "--- " . $row['email']."--- " .$row['Address']; //数据库表中的字段
echo "<br />";
}
//关闭数据库
mysql_close($con)
?>