Re: help with multidimentional arrays

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On 4/11/06, Bing Du <bdu@xxxxxxxxxxx> 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.
>

Thanks so much for pointing out that error on $arr, John.  You are very
right.  Now I realize it's such an obvious error.  But I did not notice it
before I posted.

Bing

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux