Re: [PHP] Error: unexpected T_ELSE on line 14...?

2004-07-19 Thread Dennis Gearon
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


Re: [PHP] Error: unexpected T_ELSE on line 14...?

2004-07-18 Thread John W. Holmes
Harlequin wrote:
  if ($_SESSION[Authorised]=Yes);
You know this will _always_ be true, don't you?
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Error: unexpected T_ELSE on line 14...?

2004-07-18 Thread Curt Zirzow
* Thus wrote Harlequin:
 
 if ($_SESSION[Authorised]=Yes);
 {
 // Body ~ Verified User:
 echo brbrbr;
 echo pThank you $UserCName, Now please just provide the following
 information
 and your aProfile will be loaded.;
  }
 else - The offending line...!
 {
 echo You need to go back and complete the fields correctly...!;
 }

You should really work on your indentation*:

if ($_SESSION['Authorized'] == 'Yes' ) 
{
  echo 'p style=padding-top: 3em;Thank you.../p';
}
else 
{
  echo 'pYou need to go back.../p';
}



* I'll ignore the html part for now :)

Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

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



Re: [PHP] Error: unexpected T_ELSE on line 14...?

2004-07-18 Thread Rodrigo Castro Hernandez

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,


-- 
Rodrigo Castro Hernandez

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



Re: [PHP] Error: unexpected T_ELSE on line 14...?

2004-07-18 Thread Sean Malloy
 1. The obvious ; at the end of the line.
 2. $_SESSION[Authorised]=Yes it's different to write:
$_SESSION[Authorised]==Yes


Gotta love c style languages where variable assignment is like variable
comparison.

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



Re: [PHP] Error: unexpected T_ELSE on line 14...?

2004-07-18 Thread Curt Zirzow
* Thus wrote Rodrigo Castro Hernandez:
 
 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
 

nice catch.


Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

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