mySql删除仅删除数据而不是整个条目
大家好,我的 php 代码中有这一行,
`$insert = "DELETE FROM allocation_table WHERE job = '$jobnumber' " ;
Mysql_query ($insert) ;`
问题是它将删除表中这一行的所有值,但不会删除条目本身。正如您在图片中看到的,如果我删除 where job = 315 ,它不会删除该行,但会删除
它前面的代码中的所有条目(另一个表)。它工作正常,整条线都被删除了,
$insert = "DELETE FROM event WHERE jobnumber = '$jobnumber' " ;
mysql_query ($insert) ;enter code here
有人可以提供一些建议吗? 替代文本 http://img34.imageshack.us/img34/4431/tablenj.jpg< /a>
Hi all I have this line in my php code
`$insert = "DELETE FROM allocation_table WHERE job = '$jobnumber' " ;
Mysql_query ($insert) ;`
The problem is it will remove all the values from the one line in my table but not the entry itself. as you can see in the picture if I delete where job = 315 , it does not delete the line but does delete all the entries
Yet in this code that preceeds it (a different table) . it works fine and the whole line is removed
$insert = "DELETE FROM event WHERE jobnumber = '$jobnumber' " ;
mysql_query ($insert) ;enter code here
can anyone offer some advice please ?? alt text http://img34.imageshack.us/img34/4431/tablenj.jpg
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您的代码中有错误处理例程吗?
您可能还想添加一些调试输出(或者更好地使用 xdebug 等调试器)
(过于简化)示例:
Do you have any error handling routines in your code?
You might also want to add some debug output (or even better use a debugger like xdebug)
(oversimplified) example:
也许您的 MySQL 表上有一些奇怪的设置,导致查询的功能不同。该表是您自己创建的(使用 PMA?)还是从其他地方导入?
当您使用 PHPMyAdmin 删除时,它运行的查询是什么?
Maybe you have some weird setting on your MySQL table that is causing the query to function differently. Did you create the table yourself (with PMA?) or import it from somewhere else?
When you delete using PHPMyAdmin, what is the query that it runs?
尝试在 PhpMyAdmin 中删除,看看会发生什么。至少在那里您可以轻松地看到任何错误消息。
您是否定义了外键和/或表约束?
Try deleting in PhpMyAdmin and see what happens. At least there you'll be able to easily see any error message.
Do you have foreign keys defined and/or table constraints?