mysql_query(“从表WHERE id-'$ id'中删除");失败了 [英] mysql_query("DELETE FROM table WHERE id-'$id'"); fails
本文介绍了mysql_query(“从表WHERE id-'$ id'中删除");失败了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试通过PHP从mySQL数据库中删除一行,但该行不起作用.我尝试了以下方法:
I'm trying to delete a row from my mySQL database via PHP and it isn't working. I have tried the following:
mysql_query("DELETE FROM table WHERE id='$id'");
mysql_query("DELETE FROM 'table' WHERE id='$id'");
mysql_query("DELETE FROM `table` WHERE id=`$id`");
$ id是唯一标识符,我已经回显了它以确保它能被使用.使用或死亡"会导致死亡.该行根本不会消失.
$id is the unique identifier and I've echoed it to make sure it's coming across. Using "or die" results in death. The row simply won't go away.
我应该尝试其他语法吗?
Any other syntax I should try?
推荐答案
错误检查帮助我发现在第二个mysql_query
之前有一个mysql_close();
.我的语法是正确的,只是我没有足够仔细地检查其余代码.
The error checking helped me discover that I had a mysql_close();
before my second mysql_query
. My syntax was correct, I just didn't check the remainder of the code carefully enough.
这篇关于mysql_query(“从表WHERE id-'$ id'中删除");失败了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文