Forum Moderators: coopster

Message Too Old, No Replies

Parse error: syntax error, unexpected $end in c:\wamp\www\sites\cismv1

         

scaleypate

10:08 pm on Jul 14, 2005 (gmt 0)

10+ Year Member



I keep getting a "Parse error: syntax error, unexpected $end in c:\wamp\www\sites\cismv1\contacts.php on line 227". Line 227 is the end of my code. From what I can tell from searching the web, it appears that there is something that is not concantenated correctly. I cannot find it though. Can anyone else see it?

Thanks for the help!

[edited by: jatar_k at 10:39 pm (utc) on July 14, 2005]
[edit reason] removed code, just too much [/edit]

jatar_k

10:13 pm on Jul 14, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



wow scaleypate, that's just too much code to sift through.

normally when you get a parse error on the last line things to for are msimatched or missing braces. Try that and try to isolate the exact point of the error.

<added>I saw a few mentions in some searching about missing quotes causing that error

dreamcatcher

10:25 pm on Jul 14, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



scaleypate, in future you`ll find indenting your code will help you with debugging. Posting a long block of messy code is not going to generate a lot of interest to be honest.

Just a thought.

jatar_k

10:36 pm on Jul 14, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



hey dreamcatcher,

remember though that the forum software nukes all the indents, it may have been indented and those <php> tags around it an attempt to keep the formatting. ;) but bestbbs is tricky for posting code.

ok I reformatted the code for myself

I get this error

Parse error: parse error, unexpected $ on line 221

I think you have a mismatched brace

where should this if end

if (isset($_POST['submit'])) {

I am thinking that it should be around this line
include_once ('header.php');

but if my indenting is correct then it isn't closed

jatar_k

10:52 pm on Jul 14, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



ok, since I removed all of your code I went through it, I was right, missing braces, but there are 2 missing

the one I identified in the above post is one

I am not sure which exactly is the other one because when 2 are missing and there is no indentation there is no way to know if I am guessing right

but this might be it

if($lname && $position && $phone1) { //if everything required is filled out

I kept deleting matched chunks until only 66 lines remained and I had 2 broken ifs left, added 2 braces and it got through the parser

dreamcatcher

6:55 am on Jul 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



remember though that the forum software nukes all the indents

Thanks jatar_k, I keep forgetting this board doesn`t format like the Invision forums.

scaleypate

1:41 pm on Jul 15, 2005 (gmt 0)

10+ Year Member



Thanks guys. That fixed the problem. Just out of curiousity, if I have a long post in the future, should I just add in the indentations manually or is there a way to copy and keep the formatting?

jatar_k

1:51 pm on Jul 15, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



there is a ton to how do I format a post, coopster and I were playing with it for a long time trying to get it right.

tabs don't work, they need to be spaces, you can use pre tags around it but that could cause a few problems. The thing is, we don't really do long code posts, they just don't get answered. In this particular case I happened to be really bored so I had over half an hour to donate, doesn't happen very often.

You notice that my first answer was correct

normally when you get a parse error on the last line things to look for are mismatched or missing braces.

so the code wasn't really necessary anyway ;)

also take a look at this thread
How much code should I post? [webmasterworld.com]