Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"parse error, unexpected $" but there's no dollar sign there! 1

Status
Not open for further replies.

SCelia

Programmer
Feb 27, 2002
82
CA
"parse error, unexpected $" but there's no dollar sign there! (it's the end of the page)

Now I've had this error before and I solved it eventually. The trouble is I forget how I solved it, I just remember I had a hell of a time doing it. And this time I have a 1300 line program! I don't even know what to begin looking for! Does anybody here remember what that error means? Celia
 
"Parse error" is the PHP engine's way of saying, "I'm confused. I realized I was confused somewhere around line x".

Parse errors are rarely caused by the line mentioned. Start at that line and go backward through your code. Look for missing or spurious double-quotes, single-quotes, semicolons, parentheses, etc. Want the best answers? Ask the best questions: TANSTAAFL!
 
if you can share the code, or at least the line that php claims is confusing it, we could help further :)
 
I solved it, missing a single closing curly bracket } on an if. The error was about 900 lines above where php had the parse error:) I solved it by copying and pasting units of my program into a new php file until the error re occurred. Then, having isolated the error to a block of code (about 200 lines) I started thinning out that block, checking each time if the error was still there. When the whole contents of my if() statment was missing, I noticed I didn't have a closing bracket! lol. Thanks. Celia
 
Encapsulating as much code as possible in subroutines is always a good idea. The technique is especially good in PHP, because of problems like the one you had -- the interpreter goes merrily along until 900 lines later something doesn't make sense to it.

It's a habit I fall out of all too often myself -- unless I know I'm going to reuse the code in a single script, I don't bother defining a bunch of functions. Want the best answers? Ask the best questions: TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top