您好我试着做类似的事情 我的疑问:
result = mysql_query('SELECT subitems.ItemID,subitems.Parent,subitems.Data,items.ID FROM subitems INNER JOIN items ON items.ID = subitems.ItemID WHERE subitems.ItemID = \''。$ item [' ID']。'\'GROUP BY subitems.Parent ASC,subitems.Data ASC');
阵 (
[ItemID] => 1
(
[Parent] => 1
(
[Data] => 1
[Data] => 2
[Data] => 3
)
)
[ItemID] => 1
(
[Parent] => 2
(
[Data] => 1
[Data] => 2
[Data] => 3
)
)
)
我尝试制作foreach以查看itemID的每个父项并按父项显示每个项目,但不是每次都重写父项的名称。 THX
答案 0 :(得分:0)
也许是嵌套的foreach(es)
foreach ($array as $item) {
foreach ($item as $parent) {
foreach ($parent as $data) {
echo $data;
}
}
}