SQL查询错误
这个查询有什么问题?
INSERT INTO Registration
(`Status`, `String`)
VALUES
('Confirmed', '0')
WHERE `String` = '". mysql_real_escape_string($user) ."'
1A:
UPDATE Registration
`Status` = 'Confirmed',
`String` = '0'
WHERE `String` = '". mysql_real_escape_string($user) ."'
What is wrong with this Query?
INSERT INTO Registration
(`Status`, `String`)
VALUES
('Confirmed', '0')
WHERE `String` = '". mysql_real_escape_string($user) ."'
1A:
UPDATE Registration
`Status` = 'Confirmed',
`String` = '0'
WHERE `String` = '". mysql_real_escape_string($user) ."'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您不在 INSERT 查询上指定 WHERE 子句,仅指定 UPDATE。
You don't specify a WHERE clause on an INSERT query, only UPDATE.
用途:
INSERT用于全新记录;如果您要更改与现有值关联的值 - 您需要使用 UPDATE。
参考:
Use:
INSERT is for brand-new records; if you are change values associated to an existing value -- you need to use UPDATE.
Reference:
可能值得梳理此页面:http://dev.mysql。 com/doc/refman/5.1/en/insert.html
It might be worth combing over this page: http://dev.mysql.com/doc/refman/5.1/en/insert.html