Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Apr 2013
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    if statement syntax error

    I get the following error:

    Parse error: syntax error, unexpected '}' in /srv/disk6/1352554/www/mydomain.co.nf/login_script.php on line 21

    from the following code:

    PHP Code:
        if ($activation_code != 1) {
            
    $login_error "Account must be activated before logging in."
        
    } elseif (mysql_num_rows($sql) == 1) {
            
    $_SESSION['email'] = $row['email'];
            
    $_SESSION['password'] = $row['password'];
            
    header('Location: user_home.php');
            exit();
        } else {
            
    $login_error "Incorrect email or password";

    where line 21 is the 3rd line in the code above.

    I count 3 "{" and 3 "}" with no other if statements or {} anywhere on the page. Any ideas?

  • #2
    New Coder
    Join Date
    Dec 2011
    Posts
    61
    Thanks
    4
    Thanked 10 Times in 10 Posts
    PHP Code:
    $login_error "Account must be activated before logging in."

  • #3
    New to the CF scene
    Join Date
    Apr 2013
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ...oops

  • #4
    Regular Coder
    Join Date
    Sep 2011
    Posts
    213
    Thanks
    15
    Thanked 5 Times in 5 Posts
    Almost every time you get an unexpected error it's because you haven't finished the line of code before it. Whether you have an extra character or missing one, thats the most common (if not all) cause of it, just a tip for future reference.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •