我试图使用print_r
循环遍历数组我得到了下面的数组,但是我正在
"注意:未定义的索引:名称"
错误,当我运行循环时,不知道我做错了什么? 请帮助
Array
(
[0] => Array
(
[0] => Array
(
[ID] => 1
[name] => Paul
[email] => 32
)
[1] => Array
(
[ID] => 2
[name] => Allen
[email] => 25
)
[2] => Array
(
[ID] => 3
[name] => Teddy
[email] => 23
)
[3] => Array
(
[ID] => 4
[name] => 4
[email] => Mark
)
[4] => Array
(
[ID] => 5
[name] => Paul
[email] => 32
)
[5] => Array
(
[ID] => 6
[name] => Allen
[email] => 25
)
[6] => Array
(
[ID] => 7
[name] => Teddy
[email] => 23
)
[7] => Array
(
[ID] => 8
[name] => 4
[email] => Mark
)
[8] => Array
(
[ID] => 9
[name] => Paul
[email] => 32
)
[9] => Array
(
[ID] => 10
[name] => Allen
[email] => 25
)
[10] => Array
(
[ID] => 11
[name] => Teddy
[email] => 23
)
[11] => Array
(
[ID] => 12
[name] => 4
[email] => Mark
)
[12] => Array
(
[ID] => 13
[name] => Paul
[email] => 32
)
[13] => Array
(
[ID] => 14
[name] => Allen
[email] => 25
)
[14] => Array
(
[ID] => 15
[name] => Teddy
[email] => 23
)
[15] => Array
(
[ID] => 16
[name] => 4
[email] => Mark
)
[16] => Array
(
[ID] => 17
[name] => Paul
[email] => ibraq22@yahooo.com
)
[17] => Array
(
[ID] => 18
[name] => Opeyemi Adam
[email] => resfvr@yahoo.com
)
[18] => Array
(
[ID] => 19
[name] => Opeyemi Adam
[email] => info@ckdigital.net
)
[19] => Array
(
[ID] => 20
[name] => Paul
[email] => ibraq22@yahooo.com
)
)
)
我的PHP循环在
之下 foreach ($retr as $page) {
echo $page['name'];
//var_dump($page);
}
此致
答案 0 :(得分:0)
您的数组是多维数组,是一个包含另外19个子元素的单个元素数组。
如果你只想迭代子元素,那么在顶层elelemt而不是父数组上运行循环:
select *
from t
where field3 <> 9999
or not exists (select null from t t2 where t2.field1 = t.field1 and field3 <> 9999)
;