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 10 of 10

Thread: parse error

  1. #1
    New to the CF scene
    Join Date
    Mar 2007
    Location
    killville,pa
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    parse error

    Parse error: syntax error, unexpected $end in /home/nakitaki/public_html/drug-game/tru/gp/html.php on line 211
    209. <?
    210. }
    211. ?>
    thanks otis

  • #2
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,044
    Thanks
    2
    Thanked 316 Times in 308 Posts
    This error is a PHP parser error, not a mysql error.

    The unexpected $end error is normally caused by a mismatch in the number of opening and closing braces - { }

    The way to correct this error is to proof read your code and make sure that there are matching { and }.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #3
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,634
    Thanks
    4
    Thanked 148 Times in 139 Posts
    also note that <? is deprecated, you should be using <?php

  • #4
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    Quote Originally Posted by guelphdad View Post
    also note that <? is deprecated
    No it's not... as long as short tags are on in the php.ini you can use it just fine. And they're on by default.

  • #5
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,044
    Thanks
    2
    Thanked 316 Times in 308 Posts
    If you are writing serious code that will be distributed or that will be used in conjunction with xml in the same file (the xml tag starts with the same <?), you should not use the short open tag. From the comments in the php.ini -

    ; NOTE: Using short tags should be avoided when developing applications or
    ; libraries that are meant for redistribution, or deployment on PHP
    ; servers which are not under your control, because short tags may not
    ; be supported on the target server. For portable, redistributable code,
    ; be sure not to use short tags.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #6
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Short tags are theoretically not deprecated. I came to this conclusion by noticing that the default setting in php is on. However, I completely agree with the disabling of the shorttags to remain not only standards compliant but to also remain 100% portable with various platform settings.

    Anyway, your code has some serious flaws. You cannot just enter sets of numbes into php code. Assuming that you are attempting to match the php closing brace, you need to output the value of the number using an echo or print function.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #7
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Quote Originally Posted by Fou-Lu View Post
    Short tags are theoretically not deprecated. I came to this conclusion by noticing that the default setting in php is on. However, I completely agree with the disabling of the shorttags to remain not only standards compliant but to also remain 100% portable with various platform settings.

    Anyway, your code has some serious flaws. You cannot just enter sets of numbes into php code. Assuming that you are attempting to match the php closing brace, you need to output the value of the number using an echo or print function.
    I think they are just copying and pasting the code and the line numbers transferred over or they put them there. I don't think its actually in the php.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #8
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    o.O
    I should pay more attention to what is actually there, instead of thinking of it just as an integer. I fail. Lol
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #9
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts
    Quote Originally Posted by Fou-Lu View Post
    Short tags are theoretically not deprecated. I came to this conclusion by noticing that the default setting in php is on. However, I completely agree with the disabling of the shorttags to remain not only standards compliant but to also remain 100% portable with various platform settings.
    I think they left the default to On to keep older PHP code working. And shouldn't be taken as an indication of whether or not it is deprecated.

  • #10
    Super Moderator JohnDubya's Avatar
    Join Date
    Nov 2006
    Location
    Missouri
    Posts
    634
    Thanks
    12
    Thanked 18 Times in 18 Posts
    Quote Originally Posted by otis_driftwood View Post
    Parse error: syntax error, unexpected $end in /home/nakitaki/public_html/drug-game/tru/gp/html.php on line 211
    Otis, I do this all the time. A couple things I've found helpful: use braces on their own line. This helps keep the code organized, and it's easier to see if you used the braces or not:

    PHP Code:
    //do this
    if (condition === true)
    {
       
    $do this;
    }

    //instead of this
    if (condition === true) {
       
    $do this;

    The former takes up more space, but it's easier to see if you missed a brace. The second saves space and is a bit harder to check for missing braces. Neither is right or wrong...they have their positives and negatives.

    Secondly, I sometimes use comments after ending braces to remind myself of what they close. For instance:

    PHP Code:
    if (condition === true
    {
       
    $do this;
    //end of if condition is exactly true 
    Just some ideas. Good luck!


  •  

    Posting Permissions

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