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>

  • 相关阅读:
    77. Combinations (Recursion)
    90. Subsets II (Back-Track, DP)
    78. Subsets (Back-Track, DP)
    131. Palindrome Partitioning (Back-Track, DP)
    41. First Missing Positive (HashTable)
    49. Group Anagrams (string, HashTable)
    76. Minimum Window Substring (String, Map)
    Leetcode Intersection of Two Linked Lists
    Cocos2d-js 开发记录:基本图形绘制
    Cocos2d-js 开发记录:骨骼动画载入
  • 原文地址:https://www.cnblogs.com/index0629/p/7904832.html
Copyright © 2011-2022 走看看