RE: [PHP] Parse error - new set of eyes?

2002-07-25 Thread John Holmes

> elseif ((!isset($HTTP_SESSION_VARS['clk']) ||
> (!isset($HTTP_SESSION_VARS['holy_cow']) ||
> (!isset($HTTP_SESSION_VARS['ipaddy']) ||
(!isset($HTTP_SESSION_VARS['a']))

Your parenthesis don't match up, if I can count correctly today.

---John Holmes...




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




Re: [PHP] Parse error - new set of eyes?

2002-07-25 Thread Nick Oostveen

Ok, I noticed a couple things.

One: There's no } ending your elseif statement.

Two (and the big one): Why all the opening brackets before your isset() 
functions? I'm not sure if you're trying to do some nested logic in there, 
but if so it will be much more readable if you use nested if statements 
instead of a single huge statement.  If you quickly count you'll see that 
you've got 8 opening brackets and only 5 closing ones.  That's where your 
problem lies.

At 02:40 PM 7/25/2002 -0600, you wrote:
>I am getting a parse error on line 14, I am trying to make sure session vars
>are being set before rendering the page.  This is lines 12,13,14 & 15.  Any
>help is appreciated.
>Jas
>
>if ((!$u_name) || (!$p_word)){
>  header("Location: index.php");
>  session_destroy();
>  exit; }
>/* Check for missing session vars */
>elseif ((!isset($HTTP_SESSION_VARS['clk']) ||
>(!isset($HTTP_SESSION_VARS['holy_cow']) ||
>(!isset($HTTP_SESSION_VARS['ipaddy']) || (!isset($HTTP_SESSION_VARS['a'])) {
>  /* Begin logging of client info to database table since session vars are
>not present */
>  require '/path/to/connection/class/db.php';
>
>
>
>--
>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




Re: [PHP] Parse error - new set of eyes?

2002-07-25 Thread Analysis & Solutions

Hi:

On Thu, Jul 25, 2002 at 02:40:28PM -0600, Jas wrote:
> I am getting a parse error on line 14, I am trying to make sure session vars
> are being set before rendering the page.  This is lines 12,13,14 & 15.

The way you posted it here, it's hard to tell which line is which.  
Layout your script the same way it will look in your email, then run it.  
More importantly, we need to see the error message.  There are TONS of
different parse errors that can happen.  Plus, I bet if you read the
message, and THINK about what it says, it'll give you a clue what to look
for.


> if ((!$u_name) || (!$p_word)){

Use empty($var) rather than (!$var) to avoid warnings where the var isn't 
even set.


>  header("Location: index.php");

Location needs a full URI:  http://www.foo.com/index.php.

But, I don't think any of those will produce parse errors.

--Dan

-- 
   PHP classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

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