There is a book/CD by 'Stroup' called 'More effective c++'. VERY excellent book. It give someting like 54 specific technicques to employ that save LOTS of time for a C++programmer.

One of the ones from that book, applies here:

DON'T write if ( variable ==/= constant){;}
INSTEAD write if( constant==/= variable){;}

Why, I was waiting for you to ask that question.

If you accidentally write the assignment operator '=' instead of '==/=', the first 
case does an assignment, and if the constant is not 0 or unset, the statment will 
always be true. In the second case, the interpreter/compiler will error out with the 
fact that you can't assign to a constant.

So do this:

$var_to_test = FALSE;
if( TRUE = $var_to_test){;}
if($var_to_test = TRUE ){;}
if( TRUE == $var_to_test){;}
if($var_to_test == TRUE ){;}


and see what happens.

<quote ------------------------------------------------------->

"Rodrigo Castro Hernandez" <[EMAIL PROTECTED]> wrote:

Hi,

You have two problems in these line:


Harlequin said:


if ($_SESSION["Authorised"]="Yes");



1. The obvious ";" at the end of the line. 2. $_SESSION["Authorised"]="Yes" it's different to write: $_SESSION["Authorised"]=="Yes"


Cheers,

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



Reply via email to