Jochem Maas wrote:
Paul,
the warning that John refers to does occur - whether you see it
depends on the error reporting level, PHP will create the array for you
if you have not already initialized it but a warning will be generated
in such cases. ...
error_reporting = E_ALL
...
display_er
Paul,
the warning that John refers to does occur - whether you see it
depends on the error reporting level, PHP will create the array for you
if you have not already initialized it but a warning will be generated
in such cases. - errors that may not display on one machine might be
visible
From: "Paul Furman" <[EMAIL PROTECTED]>
> So when assigning values to an array inside a loop, it knows to advance
> to the next but then if I want to print those out at the same time, it's
> complaining
>
>while ($file = readdir($fh)){
>if (strstr ($file, '.jpg')){
>$pictures[]
OK thanks again for helping through the stumbling blocks... I'm rolling
again now.
John W. Holmes wrote:
Just make sure $pictures is defined as an array before you try to push a
value onto it (even using the method you have now), otherwise you'll get a
warning.
It seems to be working fine this wa
- Original Message -
From: "Paul Furman" <[EMAIL PROTECTED]>
> Totally ignorant need for clarification... Should I set up a counter for
> loops $integer++ or if I'm going through something, the while function
> knows to just go through those and fills in array numbers accordingly?
[snip]
t; From: Paul Furman [mailto:[EMAIL PROTECTED]
> Sent: Friday, February 06, 2004 3:09 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] beginner question about while loops
>
>
> Eric Gorr wrote:
> >
> >> the while function knows to just go through those and fills in
"Paul Furman" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Eric Gorr wrote:
[snip]
>
>while ($file = readdir($fh)){
>if (strstr ($file, '.jpg')){
>$pictures[] = $file;
>#print $pictures[]; #Fatal error: Cannot use [] for reading
Which element are yo
Eric Gorr wrote:
the while function knows to just go through those and fills in array
numbers accordingly?
The while function has nothing to do with it. Using the syntax $array[]
simply adds an element onto the _end_ of the array and PHP picks the
next logical, numerical index.
OK thanks gu
You didn't close your loop;
while ($file = readdir($dh)){
if (strstr ($file, '.jpg')){
$pictures[] = $file;
}
#vardump ($pictures[]);
} <= here
?>
instead of;
while ($file = readdir($dh)){
if (strstr ($file, '.jpg')){
$pictures[] = $fi
At 11:41 AM -0800 2/6/04, Paul Furman wrote:
while ($file = readdir($dh)){
if (strstr ($file, '.jpg')){
$pictures[] = $file;
}
Spotted this problem when staring at your code.
Number of open braces: 2
Number of close braces: 1
You need to close off your while loop.
Should I set
10 matches
Mail list logo