Please help with Parse Error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
urb
Forum Newbie
Posts: 21
Joined: Fri Nov 08, 2002 1:08 am
Location: Los Angeles, California

Please help with Parse Error

Post by urb »

My error keep occuring after the very last line of code no matter what I do. The error reads

Parse error: parse error in /home/webtemp/public_html/new/template.php on line 350

On line 349 is the last actual line of code ending the html block </html>

Does anyone have any ideas of what might be happening.


Matt
User avatar
Elmseeker
Forum Contributor
Posts: 132
Joined: Sun Dec 22, 2002 5:48 am
Location: Worcester, MA

Post by Elmseeker »

Can you please post the last few lines of PHP in here? including the ?> ? Also, make sure all of your (),{}, [], "", and '' sets are properly closed and all of your ;'s are in place. These are the most common reasons for getting a parse error.
User avatar
Bill H
DevNet Resident
Posts: 1136
Joined: Sat Jun 01, 2002 10:16 am
Location: San Diego CA
Contact:

Post by Bill H »

As elmseeker suggested, it's almost certain you aren't closing something.
most likely a {} pair.
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

Bill H is right.. I get this error now and again as well and it's just down to you missing something out (or not closing something) in the PHP script.

You will just have to go through it line by line and track down the missing bit.
oldtimer
Forum Contributor
Posts: 204
Joined: Sun Nov 03, 2002 8:21 pm
Location: Washington State

Post by oldtimer »

Yeah. A missing {} will do that alot. Print out your code and then do what I do. Take a pencil and mark each one to make sure they all are in there.
User avatar
Takuma
Forum Regular
Posts: 931
Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:

Post by Takuma »

Mine's got a simliar error and I can't work it out.

Check this out please:-

http://www.ticktaku2000.com/articles.php
oldtimer
Forum Contributor
Posts: 204
Joined: Sun Nov 03, 2002 8:21 pm
Location: Washington State

Post by oldtimer »

Parse error: parse error, unexpected $ in /usr/home/ticktaku/public_html/articles.php on line 367

Sounds like you have a $ out of place.
User avatar
Elmseeker
Forum Contributor
Posts: 132
Joined: Sun Dec 22, 2002 5:48 am
Location: Worcester, MA

Post by Elmseeker »

Takuma, do you have a $ you are trying to echo? like:

Code: Select all

<?
echo "$5.00";
?>
If so, you need to escape that $ making it:

Code: Select all

<?
echo "\$5.00";
?>
this goes for prints and any other place where you have a $ and it's not meant as part of a variable...
User avatar
Takuma
Forum Regular
Posts: 931
Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:

Post by Takuma »

No I don't have anything like that...
User avatar
James Pelow
Site Admin
Posts: 51
Joined: Sat Jun 01, 2002 5:28 am
Location: Killiney, Co. Dublin, Ireland
Contact:

Reply

Post by James Pelow »

Unexpected $ usually happens to me when I copy code out of one Encoding into a new encoding. Replace all the whitespaces and line breaks with new ones - or pinpoint it by displaying as source (.phps file).

-James
Post Reply