PHP展现数据库数据|Break易站

本文参考: PHP展现数据库数据|Break易站

连接数据库之后,我们要做的就是展示数据库里面的数据到前端了,那么,这段代码用PHP实现起来也是很简单的

<html>
<head>
<style type="text/css">
li { 
float:left; /* 往左浮动 */
}
</style>
</head>
<body>
<?php
//include_once用来连接第一个章节里面教的数据库;
include_once("connector.php");              
$rs=mysql_query("SELECT * FROM test");
if ($myrow = mysql_fetch_array($rs))
{
$i=0;
do {
$i++;
?>

<ul>
<li><?=$myrow["No"]?><li>
<li><?=$myrow["FirstName"]?><li>
<li><?=$myrow["LastName"]?><li>
</ul>
<br/>

<?php
}
while ($myrow = mysql_fetch_array($rs));
}
?>
</body>
</html>

那么,运行之后的结果如下:

posted on 2017-08-19 09:50  MrAit  阅读(121)  评论(0)    收藏  举报

导航