Sorry for the length of the code, but I felt I described the problem, 
(parse error, last line) and if I hadn't posted the entire code I 
probably would've been asked to. This list can be a little confusing 
for a newbie: just a couple days ago I read someone saying "too much 
information is better than not enough" and now I'm getting that I 
posted too much. I'm still learning! :)

What does the ! in if(!isset($id)) { $id = 0; } do? I think I get what 
this bit does in general: checks if $id has been assigned anything, if 
it's empty it gets assigned 0. Correct? Then I can use if($id) 
statements later on without having PHP return "Undefined Variable" 
errors. Right?

Thanks for your help, I'll work on my PHP listetiquette.

Jason Soza

----- Original Message -----
From: "1LT John W. Holmes" <[EMAIL PROTECTED]>
Date: Thursday, April 25, 2002 5:35 am
Subject: Re: [PHP] Parse Error - Help? (AGAIN)

> 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...


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

Reply via email to