Ben bir dizi dışarı doğru veri almak zor bir zaman yaşıyorum. İç içe foreach döngü yazdı ama iç döngü hatası "foreach () için sağlanan geçersiz argüman" atıyor. Birisi bana bu konuda yardım edebilir misiniz? Teşekkürler.
foreach($row as $val)
{
echo $val['title'].'<br>';
echo $val['author'].'<br>';
echo $val['post'].'<br>';
echo $val['entry_date'].'<br>';
echo $val['comments'].'<br>';
foreach($val as $val2)
{
echo $val['comments'].'<br>';
}
}
Array
(
[title] => First Blog
[author] => Administrator
[post] => Testing entry number one
[entry_date] => Fri, 23 Oct 2009
[comments] => Array
(
[0] => Array
(
[commenter] => Sally Anderson
[comments] => comment 1 post 1
[comment_date] => October 24th, 2009 at 5:24 AM
)
[1] => Array
(
[commenter] => Mike Jones
[comments] => comment 2 post 1
[comment_date] => October 24th, 2009 at 5:21 AM
)
)
)
Array
(
[title] => Second Blog
[author] => Administrator
[post] => Testing entry number two
[entry_date] => Sat, 24 Oct 2009
[comments] => Array
(
[0] => Array
(
[commenter] => Sally Anderson
[comments] => comment 1 post 2
[comment_date] => October 24th, 2009 at 5:21 AM
)
[1] => Array
(
[commenter] => Mike Jones
[comments] => comment 2 post 2
[comment_date] => October 24th, 2009 at 5:21 AM
)
)
)