gpt4 book ai didi

php - 如何使用php删除未选中的值并在数据库中插入选中的值?

转载 作者:行者123 更新时间:2023-11-29 11:52:55 26 4
gpt4 key购买 nike

I have table like the below one

我必须将未检查的值和新检查的值删除到数据库中。如何实现这一目标?已经存在的复选框也将再次发布。但如果他们取消选中我需要删除。这是我的以下代码:

$already_exist_category = array("68","70")
$newly_posted_category = array("124","125","68") or array("124","125");

如何更新或删除新发布的id并将其插入表中?

最佳答案

先删除不存在的id,然后插入数据。

delete from table where id not in ($already_exist_category)

insert the new id here.

关于php - 如何使用php删除未选中的值并在数据库中插入选中的值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33706083/

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