Affichage du didacticiel de site Web d'entreprise de développement PHP, informations de contact
Lorsque nous avons les informations existantes dans les données, nous pouvons utiliser les informations pour appeler la base de données
Regardez le code suivant?:
<?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>展示練習(xí)我們頁(yè)面信息</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>技術(shù)支持</th> <th>售后電話</th> <th>公司傳真</th> <th>公司主頁(yè)</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>
Requête par identifiant, puis utilisez une boucle pour afficher le contenu