我对关联数组很新。只是尝试创建一个动态关联数组。
当前数组 -
stdClass Object
(
[354] => Array
(
)
[355] => Array
(
)
)
尝试获得所需的输出
stdClass Object
(
[354] => Array
(
[activity_desc] = "description"
)
[355] => Array
(
[activity_desc] = "description"
)
)
写了一个sql来检查密钥(354,355)并返回说明。
如何将密钥和值存储在344& 355?
当前代码:
foreach ($report as $key=>$value)
{
$where = 'item_id = ' . $key . '';
$query = $db->prepare('SELECT activity_desc FROM program WHERE '. $where);
$query->execute();
$test = $query->fetch(PDO::FETCH_OBJ);
}
这是我对354的sql返回查询.355将大致相同。
stdClass Object ( [activity_desc] => <p>Send Activity</p>
提前致谢
Fugz
答案 0 :(得分:1)
$ report-&gt; $ key = $ test;