+ Reply to Thread
Results 1 to 7 of 7

Thread: PHP parse error

  1. #1
    krahny's Avatar
    krahny is offline x10Hosting Member krahny is an unknown quantity at this point
    Join Date
    Nov 2009
    Posts
    25

    Question PHP parse error

    I have a php page and when I try to load it, this error appears:

    Parse error: syntax error, unexpected $end in /home/krahny/public_html/index.php on line 86

    This doesn't make any sense to me, since line 86 is the last line, with the </html> tag.

    Could someone please help me?

    Thanks!

  2. #2
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,636

    Re: PHP parse error

    Unless you post all the code on the page it is hard to tell, but:

    1. Missing closing ?> tag
    2. Missing closing quotes on some string

    The error message is saying that it hit the end of the page expecting "more", with "more" being a closing quote, ) , } , or ?> from the PHP part of the page.
    Last edited by descalzo; 05-22-2010 at 02:44 PM.
    Nothing is always absolutely so.

  3. #3
    krahny's Avatar
    krahny is offline x10Hosting Member krahny is an unknown quantity at this point
    Join Date
    Nov 2009
    Posts
    25

    Re: PHP parse error

    Thanks, I forgot to end an else block.

    Now I have another error that I don't know what means:

    Parse error: syntax error, unexpected T_IF in /home/krahny/public_html/index.php on line 71

    Here's the php code, starting on line 61:

    61: <?php
    62:
    63: if(isset($_POST['username'])){
    64: if($error!=""){
    65: echo $error;
    66: }else{
    67: echo "Hello " . $_SESSION['logging'] . "!<br/><br/>";
    68: }
    69: }
    70: $Result=mysql_query("SELECT * FROM AllUsers WHERE userName='$_POST[username]' AND Administer='Access'");
    71: if(mysql_num_rows($Result)==0){
    72: echo "This project is currently under progress.<br/>
    73: If you are interested in helping with this project and have skills to offer, please click <a>here</a>.<br/>
    74: You may register <a href='register.php'>here</a> if you like,and, if you allow notifications, we will send you an email when this project is complete.<br/>
    75: For more information, contact us <a href='contact.php'>here</a>.";
    76: }else{
    77: echo "Welcome Administrator";
    78: }
    79: ?>

    Thanks!
    Last edited by krahny; 05-23-2010 at 04:29 PM.

  4. #4
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,636

    Re: PHP parse error

    Quote Originally Posted by krahny View Post
    Thanks, I forgot to end an else block.

    Now I have another error that I don't know what means:

    syntax error, unexpected T_IF

    Thanks!
    It means that the parser found an 'if' where there shouldn't be one. Again, usually means that the problem lies a few lines before that. Missing or additional whatever.
    Nothing is always absolutely so.

  5. #5
    krahny's Avatar
    krahny is offline x10Hosting Member krahny is an unknown quantity at this point
    Join Date
    Nov 2009
    Posts
    25

    Re: PHP parse error

    Thanks again!

    I think I forgot a : at the end of a line.

  6. #6
    lemon-tree's Avatar
    lemon-tree is offline x10 Minion lemon-tree has a spectacular aura about
    Join Date
    Nov 2007
    Posts
    1,420

    Re: PHP parse error

    Just to let you know, this line is very unsecure:
    70: $Result=mysql_query("SELECT * FROM AllUsers WHERE userName='$_POST[username]' AND Administer='Access'");
    You should read this article and follow some of its suggestions.

  7. #7
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: PHP parse error

    Quote Originally Posted by lemon-tree View Post
    You should read this article
    That article is outdated in that it doesn't cover prepared statements. The PDO driver offers this more modern solution, which has benefits beyond safety.

    For more in-depth coverage of SQL injection, read "SQL Injection Attacks by Example" and "SQL Injection Walkthrough". For a tutorial on PDO, read "Writing MySQL Scripts with PHP and PDO"
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

+ Reply to Thread

Similar Threads

  1. Parse error: syntax error, unexpected '{'
    By bigbubbax in forum Programming Help
    Replies: 2
    Last Post: 03-07-2010, 08:36 PM
  2. PHP Parse Error
    By kbjradmin in forum Programming Help
    Replies: 6
    Last Post: 04-09-2009, 10:11 AM
  3. Parse error: syntax error, unexpected
    By Fr33z4r in forum Free Hosting
    Replies: 12
    Last Post: 11-04-2007, 06:12 PM
  4. Replies: 9
    Last Post: 10-11-2007, 11:45 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers