PHP视频教学,让你更快更轻松的掌握PHP。

查看完整版本: 删除记录

061107 2008-1-13 09:33

删除记录

<form name="form1" method="post" action="">
  <table width="100%"  border="0">
    <?php do { ?>
      <tr>
      <td height="52"><?php echo $row_accountinformation['deviceID']; ?></td>
      <td height="52"><?php echo $row_accountinformation['idc']; ?></td>
      <td height="52"><?php echo $row_accountinformation['ip']; ?></td>
      <td height="52"><?php echo $row_accountinformation['account']; ?> <span class="style11"><?php echo $row_accountinformation['type']; ?></span> </td>
      <td height="52">删除</td>
      <td height="52"><?php echo $row_accountinformation['time']; ?></td>
      <td height="52"><?php echo $row_accountinformation['day']; ?></td>
    </tr>
    <?php } while ($row_accountinformation = mysql_fetch_assoc($accountinformation)); ?>
  </table>
</form>

[img]http://bbs.chinaunix.net/attachments/month_0801/20080111_9005cf456638ff97a93cfedhHRUU6LXE.jpg[/img]
我想实现的功能就是点击 删除 后,可以把这段记录删除掉.
我现在大概的想法是
<form name="form1" method="post" action="">
  <table width="100%"  border="0">
    <?php do { ?>
      <tr>
      <td height="52"><?php echo $row_accountinformation['deviceID']; ?></td>
      <td height="52"><?php echo $row_accountinformation['idc']; ?></td>
      <td height="52"><?php echo $row_accountinformation['ip']; ?></td>
      <td height="52"><?php echo $row_accountinformation['account']; ?> <span class="style11"><?php echo $row_accountinformation['type']; ?></span> </td>
      <td height="52"><a href="./delete.php">删除</a></td>
      <td height="52"><?php echo $row_accountinformation['time']; ?></td>
      <td height="52"><?php echo $row_accountinformation['day']; ?></td>
    </tr>
    <?php } while ($row_accountinformation = mysql_fetch_assoc($accountinformation)); ?>
  </table>
</form>
点删除后,转到delete.php. 这里面存放一条sql 删除语句就可以了.
现在就是不知道应该怎么把参数传递到delete.php 这个文件里.
请大家多多指点

robin 2008-1-13 10:27

你可以采用delete.php&id='记录的ID号'这样方式来把ID传到delete.php中去啊
然后再delete.php重你可以用$_GET['id'] 就可以接受到传过来的记录的id 然后就可以删除了

061107 2008-1-13 14:53

非常感谢.结果
[code]

<a href="./deletedeviceaccount.php?id=<?php echo $row_accountinformation['id']; ?>">删除</a>
[/code]


[img]http://bbs.chinaunix.net/attachments/month_0801/20080113_8cc55c103dcf3f1b6a04qY2OWUW1wu3s.jpg[/img]

现在又不知道  [b]编辑[/b]  该从哪里下手了~~

再次麻烦大家指点一 二.

robin 2008-1-13 17:04

编辑和删除道理一样啊
因为你这里编辑用了一个按钮  所以感觉有点难对吧
建议你把编辑也弄成和删除一样 一个链接好了
这样你就应该会好弄多了

061107 2008-1-13 17:27

[quote]原帖由 [i]robin[/i] 于 2008-1-13 17:04 发表 [url=http://www.dophp.net/redirect.php?goto=findpost&pid=5737&ptid=1116][img]http://www.dophp.net/images/common/back.gif[/img][/url]
编辑和删除道理一样啊
因为你这里编辑用了一个按钮  所以感觉有点难对吧
建议你把编辑也弄成和删除一样 一个链接好了
这样你就应该会好弄多了 [/quote]

搞定,谢谢指点

[[i] 本帖最后由 061107 于 2008-1-13 19:31 编辑 [/i]]
页: [1]
查看完整版本: 删除记录