<?while ($result and $rs=mysql_fetch_array($result)){
?>
<tr>
<TD width="12%" align=center>序号 </TD>
<TD width="29%" align=center>$rs["姓名"]</TD>
<TD width="26%" align=center>姓别</TD>
<TD width="33%" align=center>内容</TD> </tr><? }?>
?>
<tr>
<TD width="12%" align=center>序号 </TD>
<TD width="29%" align=center>$rs["姓名"]</TD>
<TD width="26%" align=center>姓别</TD>
<TD width="33%" align=center>内容</TD> </tr><? }?>
<?PHP
//连接数据库
$conn=mysql_connect("localhost","root","root") or die("Could not conntct".mysql_error());
print "Connected successfully!";
//选择数据库名
mysql_select_db("ecc") or die("Could not select database".mysql_error());
print "Selected successfully!";
//运行SQL语句产生数据记录集
$query="SELECT * FROM MATERIAL";
$data=@mysql_query($query) or die("Query failed!");
print "<table border=1><tr>\n";
while ($line = @mysql_fetch_array($data, MYSQL_ASSOC)) {
print "\t<tr>\n";
foreach ($line as $col_value) {
print "\t\t<td>$col_value</td>\n";
}
print "\t</tr>\n";
}
print "</table>\n";?> </body>