I don't have your original code (which, btw, you shoudn't ever post that
much code without explicitly saying what the error was, what line it was
one, highlighting that line, and saying what you've done so far), but these
errors are caused by not giving a default value to a variable, basically.

If you have something like this:

if($id = 5)
{
  //whatever
}

and $id hasn't been assigned a value, then you'll get that warning. In
previous versions of PHP, you wouldn't get the warning, you'd just get
FALSE.

So, before you test the value of a variable, or echo the value out, make
sure you've assigned it something.

if(!isset($id)) { $id = 0; }

Hopefully that's not too confusing....it's hard to explain.

---John Holmes...


----- Original Message -----
From: "Jason Soza" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 25, 2002 12:06 AM
Subject: RE: [PHP] Parse Error - Help? (AGAIN)


> Yike, now I wish I hadn't found it:
>
> [Wed Apr 24 19:42:18 2002] [error] PHP Warning:  Wrong datatype for second
> argument in call to in_array in beta_up.asp on line 61
> [Wed Apr 24 19:42:18 2002] [error] PHP Warning:  Undefined variable:
> upload_path in beta_up.php on line 73
> [Wed Apr 24 19:42:18 2002] [error] PHP Warning:  Undefined variable:
> timestamp in beta_up.php on line 73
> [Wed Apr 24 19:42:18 2002] [error] PHP Warning:  Undefined variable:  id
in
> beta_up.php on line 73
> [Wed Apr 24 19:42:18 2002] [error] PHP Warning:  Undefined variable:
> HTTP_POST_FILES in beta_up.php on line 78
> [Wed Apr 24 19:42:18 2002] [error] PHP Warning:  Undefined variable:
> upload_path in beta_up.php on line 79
> [Wed Apr 24 19:42:18 2002] [error] PHP Warning:  Undefined variable:
> timestamp in beta_up.php on line 79
> [Wed Apr 24 19:42:18 2002] [error] PHP Warning:  Undefined variable:  id
in
> beta_up.php on line 79
> [Wed Apr 24 19:42:18 2002] [error] PHP Warning:  Undefined variable:
> message in beta_up.php on line 83
> [Wed Apr 24 19:42:18 2002] [error] PHP Warning:  Undefined variable:
> filename3 in beta_up.php on line 177
> [Wed Apr 24 19:42:18 2002] [error] PHP Warning:  Undefined variable:
> filename4 in beta_up.php on line 178
>
> What more do I have to do to define variables? I name what each variable
is
> with normal conventions - what would cause the above error messages? I
think
> the one that's most disturbing is the in_array() warning, need that to
work!
>
> Again, any help would be greatly appreciated!
>
> Jason
>
> -----Original Message-----
> From: Jason Soza [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 24, 2002 7:56 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [PHP] Parse Error - Help?
>
>
> Found it - just added another curly brace to the end of the code and it
> worked, so I searched up from there and found:
>
> function ext_valid ($filename) {
>
>          $extget = substr( strrchr($filename, "."), 1);
>
>          $found = in_array($extget, $extval);
>
>          if ( $found ) {
>             echo "<p><font color='red'><center>"
>                . $message["invext"]."</font></center></p>";
>
>             $rc = 2;
> }
>
> This function should have another curly brace at the end. Aha! Thanks for
> your help!
>
> Jason
>
> -----Original Message-----
> From: Tyler Longren [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 24, 2002 7:22 PM
> To: Jason Soza; [EMAIL PROTECTED]
> Subject: Re: [PHP] Parse Error - Help?
>
>
> Copy and paste the parse error into your e-mail.  Also, try placing
another
> "}" at the end of the code.  If you're missing a closing bracket
somewhere,
> that will take care of it.
>
> Tyler Longren
> Captain Jack Communications
> www.captainjack.com
> [EMAIL PROTECTED]
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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

Reply via email to