Reputation: 3461
I have results of an MySQL query. If I then create an array like:
$List = array();
do {
$List[] = $row;
} while($row = $test->fetch_assoc());
When I echo the content I get:
Array ( [0] => [1] => Array ( [SeqID] => SeqID0201 ) [2] => Array ( [SeqID] => SeqID0202 ) [3] => Array ( [SeqID] => SeqID0203 ) )
If I then pass the array through a foreach loop
foreach($List as $key => $value) {
echo $key.' '.$value.'<br />';
}
I get:
1 Array
2 Array
3 Array
My question, how can I get the content of the query result array to pass through the foreach loop to produce the data.
Thanks for your help.
Upvotes: 1
Views: 43
Reputation: 106
You probably want the result of :
foreach($List as $key => $value) {
echo $key.' '.$value['SeqID'].'<br />';
}
Upvotes: 2