Rumah >pembangunan bahagian belakang >tutorial php > PHP 在table中剔除一条记录
PHP 在table中删除一条记录
各位好,初次接触PHP弱弱的文革问题,
我想点击删除按钮的时候删除一条记录。如下图
下面把代码贴出来,
<br /> <br /> <script language="javascript" ><br /> function Delete11(var id)<br /> { <br /> .................<br /> }<br /> </script><br /> <form action="delete.php" method = "post"><br /> <table border = "1" cellpadding = "3" align = "center"><br /> <tr> <br /> <th>编号</th><br /> <th>商品名称</th> <br /> <th>商品货号</th> <br /> <th>商品价格</th><br /> <th>促销价</th><br /> <th>操作</th><br /> </tr> <br /> <?php <br /> include ('..\Conn\ConnectionDB.php');<br /> $sql = "select *from products";<br /> $result = mysql_query($sql);<br /> $row = mysql_fetch_row($result);<br /> while ($row){<br /> ?><br /> <br /> <tr><br /> <td><?php echo $row[0]?></td><br /> <td><?php echo $row[3]?></td><br /> <td><?php echo $row[2]?></td><br /> <td><?php echo $row[11]?></td><br /> <td><?php echo $row[12]?></td><br /> <td><button onclick = Delete11(<?php echo $row[0]?>)>删除</button></td><br /> </tr><br /> <?php <br /> $row = mysql_fetch_row($result);}<br /> ?><br /> </table><br /> </form><br />