gpt4 book ai didi

php - 如何在选择查询中存储数组变量

转载 作者:行者123 更新时间:2023-11-29 13:33:02 25 4
gpt4 key购买 nike

我想知道如何将数组变量存储到选择查询中,以及是否可以在 while 循环中包含以下内容。提前致谢。

例如:

$roww = array();
while ($roww = $resultt->fetch_assoc()) {

$uery = $dbconn->prepare("SELECT user_ids FROM t_friendship WHERE friend_ids = $roww['id'] AND status = 'Pending'");
$uery->execute();
$uery->store_result();

$rows = $uery->num_rows;}

最佳答案

在数组变量周围使用大括号,如下所示 {$roww['id']}

您还可以在 while 循环内和一个 SELECT 中构造一串 ids,例如 ('1','2','3') while 之外,您可以使用 MySQLIN 来选择结果。

关于php - 如何在选择查询中存储数组变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19150439/

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