PHP开发企业网站教程之展示联系我们的信息
当我们数据了存在信息,我们就可以用个调用数据库的信息
看如下代码:
<?php
require_once('conn.php');
$sql = "SELECT * from contact order by id desc";
$res = mysql_query($sql);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>展示练习我们页面信息</title>
<style type="text/css">
.top{height:30px;line-height:30px;float:right;margin-right:15px;}
.top a{color:red;text-decoration:none;}
.cont{width:100%;height:300px;float:left;}
.cont_ct{float:left;}
table{width:100%;border:1px solid #eee;text-align:center;}
th{background:#eee;}
td{width:200px;height:30px;}
</style>
</head>
<body>
<div class="top"><a href="addta.php">添加公司信息</a></div>
<div class="cont">
<table cellspacing="0" cellpadding="0" border="1">
<tr>
<th>公司地址</th>
<th>公司电话</th>
<th>技术支持</th>
<th>售后电话</th>
<th>公司传真</th>
<th>公司主页</th>
<th>电子邮件</th>
<th>操作</th>
</tr>
<?php
while($row = mysql_fetch_array($res)){
?>
<tr>
<td><?php echo $row['site'];?></td>
<td><?php echo $row['tel'];?></td>
<td><?php echo $row['suppot'];?></td>
<td><?php echo $row['nexttel'];?></td>
<td><?php echo $row['fax'];?></td>
<td><?php echo $row['home'];?></td>
<td><?php echo $row['email'];?></td>
<td>
<a href="modifycon.php?id=<?php echo $row['id'];?>">修改</a>
<a href="delcontact.php?id=<?php echo $row['id'];?>">删除</a>
</td>
</tr>
<?php
}
?>
</table>
</div>
</body>
</html>通过 id 查询,然后使用循环展示内容
neue Datei
<?php
require_once('conn.php');
$sql = "SELECT * from contact order by id desc";
$res = mysql_query($sql);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>展示练习我们页面信息</title>
<style type="text/css">
.top{height:30px;line-height:30px;float:right;margin-right:15px;}
.top a{color:red;text-decoration:none;}
.cont{width:100%;height:300px;float:left;}
.cont_ct{float:left;}
table{width:100%;border:1px solid #eee;text-align:center;}
th{background:#eee;}
td{width:200px;height:30px;}
</style>
</head>
<body>
<div class="top"><a href="addta.php">添加公司信息</a></div>
<div class="cont">
<table cellspacing="0" cellpadding="0" border="1">
<tr>
<th>公司地址</th>
<th>公司电话</th>
<th>技术支持</th>
<th>售后电话</th>
<th>公司传真</th>
<th>公司主页</th>
<th>电子邮件</th>
<th>操作</th>
</tr>
<?php
while($row = mysql_fetch_array($res)){
?>
<tr>
<td><?php echo $row['site'];?></td>
<td><?php echo $row['tel'];?></td>
<td><?php echo $row['suppot'];?></td>
<td><?php echo $row['nexttel'];?></td>
<td><?php echo $row['fax'];?></td>
<td><?php echo $row['home'];?></td>
<td><?php echo $row['email'];?></td>
<td>
<a href="modifycon.php?id=<?php echo $row['id'];?>">修改</a>
<a href="delcontact.php?id=<?php echo $row['id'];?>">删除</a>
</td>
</tr>
<?php
}
?>
</table>
</div>
</body>
</html>
Vorschau
Clear
- Kursempfehlungen
- Kursunterlagen herunterladen
Die Kursunterlagen stehen derzeit nicht zum Download zur Verfügung. Die Mitarbeiter organisieren es derzeit. Bitte schenken Sie diesem Kurs in Zukunft mehr Aufmerksamkeit
Auch Studierende, die diesen Kurs gesehen haben, lernen
Lassen Sie uns kurz über die Gründung eines Unternehmens in PHP sprechen
Kurze Einführung in die Web-Frontend-Entwicklung
Umfangreiche, praktische Tianlongbabu-Entwicklung eines Mini-Version-MVC-Frameworks, das die Enzyklopädie-Website mit peinlichen Dingen imitiert
Erste Schritte mit der praktischen PHP-Entwicklung: Schnelle PHP-Erstellung [Small Business Forum]
Anmeldebestätigung und klassisches Message Board
Wissenssammlung über Computernetzwerke
Schnellstart-Node.JS-Vollversion
Der Frontend-Kurs, der Sie am besten versteht: HTML5/CSS3/ES6/NPM/Vue/...[Original]
Schreiben Sie Ihr eigenes PHP-MVC-Framework (40 Kapitel ausführlich/große Details/Muss gelesen werden, damit Neulinge vorankommen)
















