国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

PHP Development Student Management Tutorial Browse

Create the index.php file

The code flow is as shown below

11.jpg

index.php code is as follows

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>學(xué)生信息管理</title>
    <script>
        function doDel(id) {
            if(confirm('確認(rèn)刪除?')) {
                window.location='action.php?action=del&id='+id;
            }
        }
    </script>
</head>
<body>
    <?php
    include ("menu.php");
 ?>
 <h3>瀏覽學(xué)生信息</h3>
    <table width="350" border="1" cellspacing="0">
        <tr>
            <th>ID</th>
            <th>姓名</th>
            <th>性別</th>
            <th>年齡</th>
            <th>班級(jí)</th>
            <th>操作</th>
        </tr>
        <?php
 //    1. 鏈接數(shù)據(jù)庫(kù)
 header("content-type:text/html;charset=utf8");
 $conn=mysqli_connect("localhost","root","root","study");
        mysqli_set_charset($conn,"utf8");
 //2.執(zhí)行sql
 $sql_select = "select * from stu";
 //3.data 解析
 foreach ( $conn->query($sql_select) as $row) {
 echo "<tr>";
 echo "<th>{$row['id']} </th>";
 echo "<th>{$row['name']}</th>";
 echo "<th>{$row['sex']} </th>";
 echo "<th>{$row['age']} </th>";
 echo "<th>{$row['class']}</th>";
 echo "<td>
          <a href='edit.php?id={$row['id']}'>修改</a>
          <a href='javascript:void(0);' onclick='doDel({$row['id']})'>刪除</a>
        </td>";
 echo "</tr>";
        }
 ?>
 </table>
</body>
</html>


Continuing Learning
||
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>學(xué)生信息管理</title> <script> function doDel(id) { if(confirm('確認(rèn)刪除?')) { window.location='action.php?action=del&id='+id; } } </script> </head> <body> <?php include ("menu.php"); ?> <h3>瀏覽學(xué)生信息</h3> <table width="350" border="1" cellspacing="0"> <tr> <th>ID</th> <th>姓名</th> <th>性別</th> <th>年齡</th> <th>班級(jí)</th> <th>操作</th> </tr> <?php // 1. 鏈接數(shù)據(jù)庫(kù) header("content-type:text/html;charset=utf8"); $conn=mysqli_connect("localhost","root","root","study"); mysqli_set_charset($conn,"utf8"); //2.執(zhí)行sql $sql_select = "select * from stu"; //3.data 解析 foreach ( $conn->query($sql_select) as $row) { echo "<tr>"; echo "<th>{$row['id']} </th>"; echo "<th>{$row['name']}</th>"; echo "<th>{$row['sex']} </th>"; echo "<th>{$row['age']} </th>"; echo "<th>{$row['class']}</th>"; echo "<td> <a href='edit.php?id={$row['id']}'>修改</a> <a href='javascript:void(0);' onclick='doDel({$row['id']})'>刪除</a> </td>"; echo "</tr>"; } ?> </table> </body> </html>
submitReset Code