Forum Moderators: coopster

Message Too Old, No Replies

error: unexpected $

on the last line

         

mcibor

2:03 pm on Apr 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I recently got an error:

Parse error: parse error, unexpected $ in /var/www/html/sls/zalwynik.html on line 69

Which is the last line '?>'

Could someone please let me know what this error might mean? There's no excess $.

Michal Cibor

PS if you wish I can post the code, it's 70 lines however

brucec

2:43 pm on Apr 26, 2005 (gmt 0)

10+ Year Member



You may not have closed a string literal. IN other words, your PHP may be missing a closing quotation mark.

jatar_k

4:28 pm on Apr 26, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



or has an extra one or missing a concatenation operator, like this

$mystring = "some text " $myvar . " more text";

who knows

you know you dont have to post the whole code, that really doesn't help anyway as other members don't often have the time to wade through tons of other people's code to find a semi colon.

My suggestion: post line 69, since that is where the error is, if no one sees it there they will ask for a line or two before or after, it helps you get a much quicker, and more concise, answer. ;)

Robert Thivierge

5:10 pm on Apr 26, 2005 (gmt 0)

10+ Year Member



To avoid this very common php problem in the future, you should look at getting a text editor that supports color syntax highlighting for php. There are multiple choices, including free/sharewhare, that you should be able to find easily with Google or other means (or ask if you can't find one).

mcibor

5:30 pm on Apr 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ok. I found the error - it was one missing } in if{}
For a moment I had:

if($a) {//do sth
}else{
if($b && $c) break;
else{//do sth
//here's the missing closing bracket }
}

if($a) //do sth. However I corrected the ifs to just one if $a, and seems to work finely

Thanks for your answers!
Michal Cibor

BTW To write php, js and html I use Midnight Commander, which is not very clever program, but opens the files very fast. And I got used to it. (it has highlighting)