Jump to content

Parse error: syntax error, unexpected '}'


Recommended Posts

I ppl. I have a login system. When i run on my computer (windows using wamp) give me this:

Parse error: syntax error, unexpected '}' in C:\WebDesigN\Sites\LOGIN\paginaProtegida.php on line 37

And in my site on web (linux) no... What is the problem in my wamp? sothing is not active?

 

THANKS.

Rafael Rocha - Portugal

 

ba the way the code is:

 

<?

//Inicia a sessão

session_start();

//agora verifico se ele possui permissão para acessar a página

if ($validacao != "crypto")

{

?>

 

<h1>Login<h1>

 

 

<?

}

else

{

 

?>

 

 

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

</head>

 

<body>

THis is the page, protected.

</body>

 

</html>

<?php } ?>

 

Link to comment
https://forums.phpfreaks.com/topic/116735-parse-error-syntax-error-unexpected/
Share on other sites

I see no error. I get no error running that script.  Given that what you posted is much shorter than 37 lines, the error message suggests that you actually have more code than you posted.  The problem likely originates from a missing loop start curly brace.

I see no error. I get no error running that script.  Given that what you posted is much shorter than 37 lines, the error message suggests that you actually have more code than you posted.  The problem likely originates from a missing loop start curly brace.

 

give me the error on <?php } ?> ... but just on my computer, using wamp. there is any i can change on wamp to hide this problem?

The code you posted doesn't have 37 lines of code (the error is on line 37 according to your error), it has 29!

 

Anyway, I think your problem could be related to your WAMP server not having a setting called short_open_tag enabled. short tags are disabled by default. You'll need to enable this setting in your php.ini file. After making any changes to the php.ini make sure you restart WAMP.

The code you posted doesn't have 37 lines of code (the error is on line 37 according to your error), it has 29!

 

Anyway, I think your problem could be related to your WAMP server not having a setting called short_open_tag enabled. short tags are disabled by default. You'll need to enable this setting in your php.ini file. After making any changes to the php.ini make sure you restart WAMP.

 

 

yes!! was that! i put short_opn_tag, and works! your guys are the best in world in php! thanks!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.