DELETE FROM语句不起作用 [英] DELETE FROM statement not working

查看:490
本文介绍了DELETE FROM语句不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在数据库中有一个名为线程"的表,我想删除ID等于由URL设置的$ forumid的行.该URL如下所示:domain.com/viewThread.php?forumid=1 我正在使用

I have a table in a database called 'threads' and I want to delete a row where the id is equal to $forumid which is set by the URL. The URL looks something like this: domain.com/viewThread.php?forumid=1 I am getting this using

 $forumid = $_GET['forumid'];

我确信这是可行的,因为我使用

and I am sure that this is working because I use

echo $forumid;

,它可以正常工作.但是当我使用

and it works correctly. But when I go to delete a row using

$db->query("DELETE FROM threads WHERE id='$forumid'");

由于某种原因,它无法正常工作. 有人可以帮我吗? phpMyAdmin或mySQL数据库是否有问题?

its not working for some reason. Can somebody please help me with this? Is it possible that there is something wrong with my phpMyAdmin or mySQL database?

推荐答案

检查查询

("DELETE FROM threads WHERE id= '.$forumid.'");

这篇关于DELETE FROM语句不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆