#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    6
    Rep Power
    0

    Parse error-unexpected end of file line 28


    Hi can someone check this code and tell me how to fix it, cannot figure out where the error is.

    <HTML>
    <?php
    if($submit)
    {
    $db = mysql_connect("localhost", "root","LaTorre1937##");
    mysql_select_db("learndb",$db);
    $sql = "INSERT INTO personnel (firstname, lastname, nick, email, salary)
    VALUES ('$first','$last','$nickname','$email','$salary')";
    $result = mysql_query($sql);
    echo "Thank you! Information entered.\n";
    }
    else
    {
    ?>
    <form method="post" action="input.php">
    First name:<input type="Text" name="first"><br>
    Last name:<input type="Text" name="last"><br>
    Nick Name:<input type="Text" name="nickname"><br>
    E-mail:<input type="Text" name="email"><br>
    Salary:<input type="Text" name="salary"><br>
    <input type="Submit" name="submit" value="Enter information"></form>
    <?
    }
    ?>
    </HTML>
  2. #2
  3. No Profile Picture
    I haz teh codez!
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Dec 2003
    Posts
    2,559
    Rep Power
    2338
    Please post your code in code tags so it's readable.

    Unexpected end means the PHP interpreter was expecting a } and didn't find one. The likely reason in this case is that you used a short opening tag ( <? ) before your last } and your configuration is not setup to allow short_open_tags.

    Comments on this post

    • Jacques1 agrees : Good catch regarding the short tags.
    I ♥ ManiacDan & requinix

    This is a sig, and not necessarily a comment on the OP:
    Please don't be a help vampire!

IMN logo majestic logo threadwatch logo seochat tools logo