RE: [PHP] help, array values echoed as Array on loop!
| From: | Victor | Date: | Mon, 02 Sep 2002 22:19:44 +0000 |
| Subject: | RE: [PHP] help, array values echoed as Array on loop! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-114963@lists.php.net to get a copy of this message | ||
Thank you, I figured it out 30 seconds after I posted the question, you
were right about the problem.
- Victor > www.argilent.com
-----Original Message-----
From: Chris Wesley [mailto:cwwesley@udlug.org]
Sent: Monday, September 02, 2002 4:11 PM
To: 'PHP'
Cc: Victor
Subject: Re: [PHP] help, array values echoed as Array on loop!
On Mon, 2 Sep 2002, Victor wrote:
> $ID_arr[] = explode(',', $pictures); # make db data into array
> This is the string:
> 15,16,17,18,19
>
> why does it echo as Array?
... because you've created an array ($ID_arr) with an array as the first
value (the result of the call to explode()). Take the brackets off
$ID_arr, and you'll get what you want. You don't want your array in an
array ... you just want an array.
$ID_arr = explode(',', $pictures);
If you really wanted your array in the array, then loop over $ID_arr[0].
(I doubt that's what you were going for, though.)
hth,
~Chris
______________________________________________________________________
Post your free ad now! http://personals.yahoo.ca