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 6 of 6
  1. #1
    New Coder
    Join Date
    Aug 2011
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Parse Error: Unexpected $End

    Hey everyone, I've been working on this for a while now and cannot seem to figure out the reason. Ive been getting this sort of error on my profile.php page:

    Parse error: syntax error, unexpected $end in /home/gameange/public_html/profile.php on line 1457

    Line 1457 is at the very end of the code, and I can't seem where the error starts.

    I know that there is a lot of code, but here is the paste: http://paste2.org/p/1913238

    If anybody would be kind enough to help me out here it would be greatly appreciated!

  • #2
    Regular Coder
    Join Date
    Mar 2004
    Location
    Australia
    Posts
    217
    Thanks
    0
    Thanked 1 Time in 1 Post
    Have you tried closing your PHP tags?

    PHP Code:
    <?php
    $bDayMSG 
    "";
    $today date("Y-m-d");
    $birthday $row['birthday'];
    if (
    $today == $birthday) {
      
    $bDayMSG "Happy Birthday! We wish you the best of luck, for this day only comes once a year! Get off of VGAnger and go spend some time with your family!";
    }
    $birthday strftime("%b %d, %Y"strtotime($birthday));
    ?>
    <div id="msg">
    <div class="txt">
    <?php
    echo $bDayMSG// Wherever you need it on the page
    ?>

    </div>
    </div>
    </body>
    </html>

  • #3
    New Coder
    Join Date
    Aug 2011
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Went through them all (at least I'm pretty sure I did). I dont think its the problem of ending tags. But, I;m not sure

  • #4
    New Coder
    Join Date
    Feb 2012
    Posts
    18
    Thanks
    0
    Thanked 1 Time in 1 Post
    Quote Originally Posted by GameAnger View Post
    Line 1457 is at the very end of the code, and I can't seem where the error starts.
    On line 1443 you have opened a PHP tag and then on line 1454 you have opened another one without closing the previous one. And then again on line 1457 without closing php tag you have inserted HTML code. Try closing these two tags and check it.

    Regards
    Mahdi Eftekhari

  • Users who have thanked Mahdi Eftekhari for this post:

    tangoforce (02-23-2012)

  • #5
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,352
    Thanks
    61
    Thanked 528 Times in 515 Posts
    As Mahdi says, you need to ensure that you always put in closing braces.

    To be sure you do, when you open a new brace put in a closing one. After the opener, hit enter twice, type in the closing brace and then use the arrow key to go up and write your code in between. This technique has helped me immensely over the years.

    Also see the coding styles and $end errors link in my signature. That topic is especially designed to help people like you with this problem.
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  • #6
    Senior Coder
    Join Date
    Apr 2010
    Posts
    1,466
    Thanks
    71
    Thanked 104 Times in 103 Posts
    Also in my experience, that closing bracket can be anywhere in the code, mostly it's at the bottom of the script for me, but I've had it at the top. When I write code, and open a new bracket, I make the closing bracket as well, as a reminder. I drop the closing bracket down a few lines while im coding to get it out of the way.
    Been a sign maker for 7 years. My business:
    American Made Signs


  •  

    Posting Permissions

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