从mysql中删除行只删除内容? [英] Delete row from mysql only deletes the contents?

查看:75
本文介绍了从mysql中删除行只删除内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

mysql_query(" DELETE FROM cart WHERE ItemId = $ ItemId");


有代码,但我的数据库中的结果是ID号改变了

来自,比方说,77到78,78'的内容为空。因此,当我看到
查看结果时 - 已删除的ID77已消失但现在我的ID78没有

内容!


有谁知道为什么以及如何让它停止?


MIchael

mysql_query("DELETE FROM cart WHERE ItemId=$ItemId");

There is the code but the result in my databse is that the ID number changes
from, lets say, 77 to 78 with 78''s contents being empty. Therefore when I
look at the results - the deleted ID77 is gone but now I have ID78 with no
content!

Does anyone know why and how do I make it stop?

MIchael

推荐答案

ItemId");


有代码,但我的数据库中的结果是ID编号改变了

,比方说,77到78含78'的内容空虚。因此,当我看到
查看结果时 - 已删除的ID77已消失但现在我的ID78没有

内容!


有谁知道为什么以及如何让它停下来?


MIchael
ItemId");

There is the code but the result in my databse is that the ID number changes
from, lets say, 77 to 78 with 78''s contents being empty. Therefore when I
look at the results - the deleted ID77 is gone but now I have ID78 with no
content!

Does anyone know why and how do I make it stop?

MIchael


de Beers写道:
de Beers wrote:
mysql_query(" DELETE FROM cart WHERE ItemId =
mysql_query("DELETE FROM cart WHERE ItemId=


ItemId");

有代码,但我的数据库中的结果是ID号更改
,比方说,77到78,78'的内容为空。因此,当我查看结果时 - 已删除的ID77已消失但现在我的ID78没有
内容!

有谁知道为什么以及如何让它停止?
ItemId");

There is the code but the result in my databse is that the ID number changes
from, lets say, 77 to 78 with 78''s contents being empty. Therefore when I
look at the results - the deleted ID77 is gone but now I have ID78 with no
content!

Does anyone know why and how do I make it stop?




你的SQL查询不能创建一个新的空行,你可能有一个糟糕的if语句

使你的INSERT查询在你删除时运行。


// Aho



Your SQL query don''t create a new empty row, you may have a bad if-statement
that makes your INSERT query to be run while you are deleting.

//Aho


这篇关于从mysql中删除行只删除内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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