Re: if elseif elseif elseif....

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

 



Shawn McKenzie wrote:
Chris wrote:
PJ wrote:
Daniel Brown wrote:
On Wed, Mar 4, 2009 at 17:51, PJ <af.gourmet@xxxxxxxxxxxx> wrote:
   elseif ($obligatoryFieldNotPresent = 1) {
           $obligatoryFieldNotPresent = 0;
   }
    Are you certain you only wanted a single equal operator in the
last elseif() condition?  Further, are you sure it should even be an
elseif() and not a straight else?

That's where the problem lies... the algorhythm is if any one of a
series is empty, then it's an error, but if they are all ls then we go
on...
So the last one should show up as "0"...
Using a single = means an assignment. Assigning a variable should never
fail.

You probably want == to do a comparison.


Yes and yes, however the it's the result of the assignment that is used:

if($var = false) {
	echo "Succeeded";
} else {
	echo "FAIL";
}

Yeh that's what I was trying to say, just did it poorly ;)

--
Postgresql & php tutorials
http://www.designmagick.com/


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