If...else parsing error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
AliHurworth
Forum Newbie
Posts: 3
Joined: Sun Jan 13, 2008 7:38 pm

If...else parsing error

Post by AliHurworth »

Hi all,
I'm sure this will seem basic, but...
I get the following error:

Code: Select all

Parse error: parse error, unexpected T_ELSE in e:\domains\h\holtworth.co.uk\user\htdocs\workhome\newworkhome.php on line 29
from this code:

Code: Select all

<div><?php
if(!isset($_COOKIE['Testcookie']));
{
echo "Welcome back";
echo $HTTP_COOKIE_VARS["TestCookie"];
}
else{
echo "Welcome to our site! Please login or register";
}
?></div>
I just can't seem to see why it won't work.
Any ideas?
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: If...else parsing error

Post by Weirdan »

There's semicolon that should not be there:

Code: Select all

if(!isset($_COOKIE['Testcookie']));// <========= here
User avatar
jimthunderbird
Forum Contributor
Posts: 147
Joined: Tue Jul 04, 2006 3:59 am
Location: San Francisco, CA

Re: If...else parsing error

Post by jimthunderbird »

Yes, it's a syntax error in line 2.
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: If...else parsing error

Post by Jonah Bron »

Yeah. I sometimes to that too, just out of habbit. :lol:
AliHurworth
Forum Newbie
Posts: 3
Joined: Sun Jan 13, 2008 7:38 pm

Re: If...else parsing error

Post by AliHurworth »

Yes, of course. Thanx all, esp 4 the prompt reply! Lesson: don't debug at 2am...
Post Reply