duan198727 2014-04-16 02:24
浏览 75

为什么我的delete.php不删除数据库内容?

I have been working on the admin side of my website now for a while.I have successfully created an add page to add items to data in database mysql.But when adding a delete.php page it does not work quite so well.When I select the one I no longer require and click delete button this msg come out and no error also when I check my site it does not delete the article.

enter image description here

this is my delete.php coding

<?php
include ("dbase.php");

//Use method $_Get to retrieve data from url
$id=$_GET['id'];

mysql_query("DELETE FROM logbook WHERE id=$id");

echo mysql_error();
header('Location:delete.php');

?>

Can someone see where I am going wrong?if you need any more info then please let me know. thanks.

  • 写回答

3条回答 默认 最新

  • douhe6181 2014-04-16 02:27
    关注

    Currently you load delete.php, delete from the database, and then redirect to delete.php. When you reload delete.php, you delete from from the database, and then redirect to delete.php. When you reload delete.php, you get the point.

    That is where the error "Redirect Loop" comes from; it will never end. Try commenting out your header() call or changing the location to another page like deleted.php.

    评论

报告相同问题?

悬赏问题

  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教