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로 쿼리한 다음 루프를 사용하여 내용을 표시합니다

지속적인 학습
||
<?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>
  • 코스 추천
  • 코스웨어 다운로드
현재 코스웨어를 다운로드할 수 없습니다. 현재 직원들이 정리하고 있습니다. 앞으로도 본 강좌에 많은 관심 부탁드립니다~