View Full Version : Parse Error: Unexpected $End

02-23-2012, 02:22 AM
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!

02-23-2012, 02:31 AM
Have you tried closing your PHP tags?

$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">
echo $bDayMSG; // Wherever you need it on the page


02-23-2012, 02:38 AM
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

Mahdi Eftekhari
02-23-2012, 03:07 AM
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.

Mahdi Eftekhari

02-23-2012, 11:19 AM
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.

02-23-2012, 01:57 PM
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.