traverse a multidimensional array
| From: | Lez Lytollis | Date: | Thu, 20 Jul 2000 13:56:51 +0000 |
| Subject: | traverse a multidimensional array | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-7414@lists.php.net to get a copy of this message | ||
Hi All,
I have populated a local array with the results of a db query using:
//do query
$result = mysql_query($query) or die(mysql_error());
//fill array
$count = 0;
$arrResult = array();
while ( $row = mysql_fetch_array($result))
{
$arrResult[$count] = $row;
$count++;
}
mysql_free_result($result);
Now I want to list the data in there. I tried using:
//check that our local array has the correct data
while(list($key,$value)=each($arrResult)) {
echo "array[$key]=$value<br>\n";
}
but all I get is:
array[0]=Array
array[1]=Array
array[2]=Array
array[3]=Array
array[4]=Array
How do I list the contents of each "second level" array? (not sure of the
correct terms)
TIA
Lez