<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
</head>
<body>
<?php
echo "这个是welcome.php 页面;";
$mysql_server_name = "localhost";
$mysql_username    = "root";
$mysql_password    = "***";
$mysql_database    ="lianxi";
$sql = "select * from student";
$conn = mysql_connect($mysql_server_name,$mysql_username,$mysql_password);
mysql_query("set names utf8");
$result = mysql_db_query($mysql_database,$sql,$conn);
$row = mysql_fetch_row($result);echo"<table border=1 cellspacing=1 cellpedding=2>\n";
echo "<b><tr></b>\n";
for($i=0;$i<mysql_num_fields($result);$i++)
{
echo "<td bgcolor='#000f00'><b>";
mysql_field_name($result,$i);
echo"</b></td></b>";
}
echo"</tr></b>";
//定位到第一条记录
while($row=mysql_fetch_row($result))
{
echo"<tr></b>\n";
for($i=0;$i<mysql_num_fields($result);$i++)
{
echo"<td bgcolor='#00ff00'>\n";
echo $row[$i];
echo "</td>";
}
echo "</tr></b>";
}
echo"</table></b>";
mysql_free_result($result);
mysql_close($conn);
?>
</body>
</html>