// open the connection
$conn = mysql_connect(host名, 用户名, 密码);
// pick the database to use
mysql_query("SET NAMES UTF8");
mysql_select_db(数据库名,$conn);
// create the SQL statement
$conn = mysql_connect(host名, 用户名, 密码);
// pick the database to use
mysql_query("SET NAMES UTF8");
mysql_select_db(数据库名,$conn);
// create the SQL statement
$sql = "SELECT * FROM 表名";
$result = mysql_query($sql, $conn) or die(mysql_error());
//go through each row in the result set and display data
while ($newArray = mysql_fetch_array($result)) {
// give a name to the fields,这个只是例子
$tid = $newArray['tid'];
//以下就是各自的应用编程
}