Re: help with multidimentional arrays
| From: | John Wells | Date: | Wed, 12 Apr 2006 08:24:25 +0000 |
| Subject: | Re: help with multidimentional arrays | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-233830@lists.php.net to get a copy of this message | ||
On 4/11/06, Bing Du <bdu@iastate.edu> wrote:
> ==
> foreach ($sponsor_id as $sponsor => $arr)
> echo "$sponsor:";
> foreach ($arr[$sponsor] as $project) {
> echo "$project<br>";
> }
> ==
>
It looks like you're building your array just fine. Here though, your
second foreach needs to look like this:
[code]
foreach ($arr as $project)
{
echo "$project<br>";
}
[/code]
Your temprorary $arr variable contains only your array of titles, not
an entire row of your 2-dimensional $sonsor_id array. So you do not
need to use the $sponsor key to get at that array.
HTH,
John W