gpt4 book ai didi

mysql - 在 MySQL 中选择更新表数据

转载 作者:行者123 更新时间:2023-11-29 06:20:25 24 4
gpt4 key购买 nike

<分区>

我正在尝试更新表中的数据。我已经在 Google 和 Stack 中搜索过,但无法实现。

这是一个 Android 应用程序。当我单击“取消订阅”按钮时,它应该将字段“isSubscribed”上的表“assinaturas”更新为 0。

此按钮,将此信息(电子邮件和姓名)发送到 php:

if (isset($_POST['email']) && isset($_POST['nome']))

这是表格 usuarios: enter image description here

这是表格播客: enter image description here

这是表 assinaturas:

Table assinaturas

我拥有的信息是“usuarios.email”和“podcasts.nome”。

这是我的尝试之一:

                            UPDATE TABLE assinaturas 
SET isSubscribed = 0
WHERE id_usuario IN (
SELECT usr.id
FROM usuarios AS usr
WHERE usr.email = '$email'
)
AND id_podcast IN (
SELECT pcst.id
FROM podcasts AS pcst
WHERE pcst.nome = '$nome'
)

对于这个查询,我遇到了语法错误:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TABLE assinaturas SET isSubscribed = 0 WHERE id_usuario IN ( ' at line 2

因此,我收到了 usuarios.emailpodcasts.nome,我需要更新 assinaturas.isSubscribed0(零)

我希望你能帮助我。谢谢。

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com