zoukankan      html  css  js  c++  java
  • 阿贾克斯数据库删除

    <!DOCTYPE html>
    <html>
    <head>
    <script type="text/javascript" src="js/jquery-1.11.3.min.js"></script>
    </head>
    <style type="text/css">
    table.imagetable {
     font-family: verdana,arial,sans-serif;
     font-size:11px;
     color:#333333;
     border- 1px;
     border-color: #999999;
     border-collapse: collapse;
    }
    table.imagetable th {
     background:#b5cfd2 url('cell-blue.jpg');
     border- 1px;
     padding: 8px;
     border-style: solid;
     border-color: #999999;
    }
    table.imagetable td {
     background:#dcddc0 url('cell-grey.jpg');
     border- 1px;
     padding: 8px;
     border-style: solid;
     border-color: #999999;
    }
    </style>

    <body>
    <table class="imagetable">
    <tr>
     <th>id</th><th>name</th><th>password</th><th>sex</th><th>college</th><th>class</th><th>telephone number</th><th>操作</th>
    </tr>
    <?php
     header( 'Content-Type:text/html;charset=utf-8 ');
      include_once("conn/conn.php");
       $sql="SELECT*from user";

      $r=mysqli_query($link,$sql);
      // $row=mysqli_fetch_array($r);

      while ($row=mysqli_fetch_array($r)) {
    ?>
     <tr>
     <td><?php echo $row["id"]?></td>
     <td><?php echo $row["name"]?></td>
     <td><?php echo $row["password"]?></td>
     <td><?php echo $row["sex"]?></td>
     <td><?php echo $row["college"]?></td>
     <td><?php echo $row["class"]?></td>
     <td><?php echo $row["tel"]?></td>
    <td><button onclick="del(<?php echo $row["id"]?>);">删除</button></td>
     </tr>

    <?php
    }
    ?>
    </table>
     <script type="text/javascript">
     function del($id){
      var id=$id;
      if(id){
           $.get("delete.php",{'id':id,},function(data){
            if(data==1){
             alert('成功');
             window.location.href=window.location.href;
            }else{
             alert('失败');
            }
           });
      }
     }
     </script>
    </body>

    </html>

  • 相关阅读:
    这是个神奇的博客
    Tomcat Access Log 的格式
    CA证书
    记一次性能调优
    web系统能力培养计划
    金融知识学习
    读《华为区块链白皮书》
    马未都说收藏:陶瓷篇(8、9)元青花、永宣青花
    阿里历年面试试题
    回车(CR)换行(LF)的来历及区别
  • 原文地址:https://www.cnblogs.com/index0629/p/7904832.html
Copyright © 2011-2022 走看看