Jump to content
xisto Community
moldboy

Unexpected $ what does it mean

Recommended Posts

You see I have a most intresting problem, basicaly I get the following error:

Parse error: parse error, unexpected $ in /path/result.php on line 99


Now normaly when I have problems I go to line 99 and add a ; or a " or something the problem is in my file line 99 is </html>,
 <tr bgcolor="#FFFFFF">    <td width="25" height="5" background="images/q3.png"> </td>    <td height="25" align="right" valign="top" background="images/bot.png"><span class="style2"><a href="help.htm">Help</a></span></td>    <td width="25" height="25" background="images/q4.png"> </td>  </tr></table><br><span class="style3">a d-gression service</span></body></html>

Infact the php ended about 20 lines ago on line 79
?>

Any idea, I can't figure out what the problem might be.

Share this post


Link to post
Share on other sites

Your problem is that you missed either a } or a ; in one of your previous lines. Find what you edited and look there. I get this now and then and I just check what I did. If you use Word Pad....or something like that...I'm sorry....get Matrix Y2k Website Studios, works wonders on telling you which { is lined up with which }.

Share this post


Link to post
Share on other sites

Thanks I had a foreach loop inside a while loop and didn't end one of them.

158994[/snapback]


 

No problem, yeah that's one thing you always have to do is check if you have ended everything.

Share this post


Link to post
Share on other sites

That and finish every line with ;, you know that is my least favorite thing about PHP. Everytime I forget it. What's even worse is that the error, unexpected something expected , or ;, well if you expected it, then put it there!

Share this post


Link to post
Share on other sites

That and finish every line with ;, you know that is my least favorite thing about PHP.  Everytime I forget it.  What's even worse is that the error, unexpected something expected , or ;, well if you expected it, then put it there!

159048[/snapback]


LoL yeah, I know...I got used to it now though, and it doesn't have to be every line cause some lines you don't need them at the end. like the ones that start if (blah = blah) { and stuff like that LoL.....You get used to it over time.

Share this post


Link to post
Share on other sites

That's what I hate about php, I always miss it out, and mess out my entire code, and wasted my whole day of coding time... I hope there's a machine tat would point out all wrong codes and fixed them automatically for you..

Share this post


Link to post
Share on other sites

That and finish every line with ;, you know that is my least favorite thing about PHP.  Everytime I forget it.  What's even worse is that the error, unexpected something expected , or ;, well if you expected it, then put it there!

159048[/snapback]


Too bad most programming languages require you to finish commands with a semicolon :unsure:

Share this post


Link to post
Share on other sites

You know it knows when we are on a new line as it returns the line number that the error is on, yet it can't deduce that we ment to end the line, but then again when you do someting like:

while(something = somethingelse){$whole bunch of stuff here;bunch more stuff}

the first bunch of stuff could technicaly follow the { and I know most people don't do that, and if it assumed each line break was ; then it would return new errors!

Share this post


Link to post
Share on other sites

You know it knows when we are on a new line as it returns the line number that the error is on, yet it can't deduce that we ment to end the line, but then again when you do someting like:

while(something = somethingelse){$whole bunch of stuff here;bunch more stuff}

the first bunch of stuff could technicaly follow the { and I know most people don't do that, and if it assumed each line break was ; then it would return new errors!

159427[/snapback]


I always hit enter after the {'s and ;'s keeps everything organized so it's alot easier to read and you can tell where an error could be earlier...like if you had something wrong with the while statement and you had something else there as well...you might change the wrong thing and create a different error and just get more confused LoL.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.