gpt4 book ai didi

php mysql 多次更新什么也不做

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

$query = "UPDATE TABLE1 
SET (row1 = '$val1' WHERE row5 = '$someid' AND active = 'yes')
, (row1 = '$val2' WHERE row5 = '$someid' AND active = 'yes')
, (row1 = '$val3' WHERE row5 = '$someid' AND active = 'yes')";

mysql_query($query);

此查询不执行任何操作。我无法更新数据。
我做错了什么?

最佳答案

UPDATE `table` SET `name`= case `id` 
when 1 then "Alex"
when 2 then "John"
when 3 then "Steve"
end
WHERE `id` in(1,2,3)

不是吗?

关于php mysql 多次更新什么也不做,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7190158/

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