processShowData.php
<html>
<head>
<title>查询数据库表信息</title>
</head>
<body>
<center>
<form name="myForm" action="processShowData.php">
<table border="1" cellspacing="0" cellpadding="0">
<caption>学生一览表</caption>
<th>学号</th>
<th>姓名</th>
<th>年龄</th>
<th>性别</th>
<th>地址</th>
<?php
$link=mysql_connect("localhost","root","root");
mysql_select_db("rorely");
$exec="select * from test";
$result=mysql_query($exec);
while($rs=mysql_fetch_object($result)){
$id=$rs->id;
$name=$rs->name;
$age=$rs->age;
$sex=$rs->sex;
$address=$rs->address;
?>
<tr align="center">
<td><?php echo $id ?></td>
<td><?php echo $name ?></td>
<td><?php echo $age ?></td>
<td><?php echo $sex ?></td>
<td><?php echo $address ?></td>
</tr>
<?php
}
mysql_close();
?>
</table>
</form>
</center>
</body>
</html>
结果如下:
<html>
<head>
<title>查询数据库表信息</title>
</head>
<body>
<center>
<form name="myForm" action="processShowData.php">
<table border="1" cellspacing="0" cellpadding="0">
<caption>学生一览表</caption>
<th>学号</th>
<th>姓名</th>
<th>年龄</th>
<th>性别</th>
<th>地址</th>
<?php
$link=mysql_connect("localhost","root","root");
mysql_select_db("rorely");
$exec="select * from test";
$result=mysql_query($exec);
while($rs=mysql_fetch_object($result)){
$id=$rs->id;
$name=$rs->name;
$age=$rs->age;
$sex=$rs->sex;
$address=$rs->address;
?>
<tr align="center">
<td><?php echo $id ?></td>
<td><?php echo $name ?></td>
<td><?php echo $age ?></td>
<td><?php echo $sex ?></td>
<td><?php echo $address ?></td>
</tr>
<?php
}
mysql_close();
?>
</table>
</form>
</center>
</body>
</html>
结果如下:
| 学号 | 姓名 | 年龄 | 性别 | 地址 |
|---|---|---|---|---|
| 1 | Jane | 26 | female | wenming cun 123# |
| 3 | Tome | 21 | male | wenming cun 32# |
| 4 | Lily | 25 | female | wenming cun 2# |
| 5 | Lucy | 25 | female | wenming cun 2# |
| 6 | Jim | 22 | male | wenmin cun 45# |
| 7 | Jim | 22 | male | wenmin cun 45# |
| 8 | Jim | 22 | male | wenmin cun 45# |
| 9 | Jim | 22 | male | wenmin cun 45# |
| 10 | Jim | 22 | male | wenmin cun 45# |
| 11 | Jim | 22 | male | wenmin cun 45# |
| 12 | Jim | 22 | male | wenmin cun 45# |
| 13 | Jim | 22 | male | wenmin cun 45# |
| 14 | Jim | 22 | male | wenmin cun 45# |
| 15 | Jim | 22 | male | wenmin cun 45# |
| 18 | Jim | 22 | male | wenmin cun 45# |
| 20 | Jim | 22 | male | wenmin cun 45# |
| 78 | lili | 22 | female | wenming cun 23# |
| 79 | hj | 30 | male | wenming cun 23# |
| 80 | hj | 30 | male | wenming cun 23# |
688

被折叠的 条评论
为什么被折叠?



