gpt4 book ai didi

PHP & MySQL 查询问题

转载 作者:太空宇宙 更新时间:2023-11-03 11:17:42 25 4
gpt4 key购买 nike

如何在我的 MySQL 查询中检查每个数组中的每个值。我希望这是有道理的。

SELECT articles_comments.comment_id FROM articles_comments
WHERE articles_comments.comment_id =

Array
(
[0] => 5
[1] => 6
[2] => 10
[3] => 11
[4] => 12
[5] => 17
[6] => 3
[7] => 4
[8] => 7
[9] => 8
[10] => 9
[11] => 16
)

AND articles_comments.user_id =

Array
(
[2] => 4
[3] => 4
[4] => 4
[8] => 4
[9] => 4
[10] => 4
)

最佳答案

像那样:

$query = "SELECT articles_comments.comment_id FROM articles_comments
WHERE articles_comments.comment_id IN(" . implode(",", $commentArray) . ")
AND articles_comments.user_id IN(". implode(",", $userArray) . ")";

?

关于PHP & MySQL 查询问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3917372/

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