foreach with multidimensions - Confused
Posted: Wed Sep 14, 2005 9:37 am
Hi,
I'm working on parsing some mysql rows into a multidimensional array, but I'm having a bit of confusion... I think I am close though.
Now, I would think i could access the elements using foreach, like this...
What am I overlooking? Thanks.
I'm working on parsing some mysql rows into a multidimensional array, but I'm having a bit of confusion... I think I am close though.
Code: Select all
$a = 0;
$result = DB_query("SELECT * FROM inquiry_data WHERE parent=0 ORDER BY title");
while ($row = DB_fetchArray($result)) {
$InquiryData[$a]['id'] = $row['id'];
$InquiryData[$a]['business'] = $row['business'];
$InquiryData[$a]['uid'] = $row['uid'];
$InquiryData[$a]['rand_id'] = $row['rand_id'];
$InquiryData[$a]['title'] = $row['title'];
$InquiryData[$a]['content'] = $row['content'];
$InquiryData[$a]['status'] = $row['status'];
$a++;
}Code: Select all
foreach ($InquiryData as $CurrentInquiry) {
echo $CurrentInquiry['title'];
}