Jul 25, 2008

Unexpected $ - what does it mean

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > PHP Programming

free web hosting

Unexpected $ - what does it mean

moldboy
You see I have a most intresting problem, basicaly I get the following error:
QUOTE
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>,
CODE
 <tr bgcolor="#FFFFFF">
   <td width="25" height="5" background="images/q3.png">&nbsp;</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">&nbsp;</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
CODE
?>


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

 

 

 


Reply

Daehawk
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 }.

Reply

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

Reply

Daehawk
QUOTE(moldboy @ Jul 8 2005, 07:23 PM)
Thanks I had a foreach loop inside a while loop and didn't end one of them.
*





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

Reply

moldboy
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!

Reply

Daehawk
QUOTE(moldboy @ Jul 9 2005, 12:07 AM)
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!
*




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.

Reply

hype
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..

Reply

beeseven
QUOTE(moldboy @ Jul 9 2005, 01:07 AM)
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!
*



Too bad most programming languages require you to finish commands with a semicolon tongue.gif

Reply

moldboy
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:
CODE
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!

Reply

Daehawk
QUOTE(moldboy @ Jul 10 2005, 10:55 AM)
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:
CODE
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!
*



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.

 

 

 


Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : unexpected

  1. Unexpected T_string In User.php [resolved]
    (5)
  2. Unexpected T_variable...
    Help! (3)
    I did construct the database connection file which is called "config.php". But, I got some mistake
    that has to be solved to continue with working. This is the code itself: //Set the database
    values $confg ="alex1985_admin" //Your database username $confg ="" //Your database
    user's password $confg ="localhost" //Your host $confg ="books" //Your database name
    //Create the function to log into the DB function db_login() { global $confg; $link =
    @mysql_connect($confg , $confg , $confg ) or die("Error connecting: " . mysql....
  3. Unexpected $ Where There Aren't Any
    (7)
    I am getting this message when testing a script I made: QUOTE Parse error: parse error,
    unexpected $ in /home/globa38/public_html/forum/mods/phpbb_fetch_all/news/forumnews.php on line
    159 On line 159, which is the last line in that file, I can only see this: CODE ?>
    What's the problem, and how can I fix it? /unsure.gif' border='0'
    style='vertical-align:middle' alt='unsure.gif' /> ....
  4. Parse: Error Unexpected T_lnumber
    php parse error when running script (4)
    Hi. I've just created a php script. The main object of the script is to delete some old files
    and replace it with a new file with some new content, effectively moving the contents from one file
    to another. These are the first 50 lines of the file: /* Calculate For The "A" Group - The
    Latest Games ID */ $a_B = 002; while(file_exists("a_" . $a_B . ".dat")) {
    $a_B++; } $new_page_contents = " " . $_POST . " " . $_POST . "
    include \"/home/cmatcme/public_html/footer.php\"; ?> "; $a_stream = fopen(&....
  5. Parse Error
    unexpected $ (1)
    i have this code CODE <?php if($_POST['user']=="" or
    $_POST['pass']=="" or $_POST['host']==""
    or $_POST['root']=="" or
    !isset($_POST['run'])){  print('<form method=post
    name=form>');  print('FTP username <input type=\'text\'
    name=user value=""><br>');  print('FTP password <input
    type=\'password\....
  6. Unexpected "$" Sign On Last Line Of File
    even if i change the line nos it's there (3)
    I am trying to create a file which send mail after a user has filled in the appropiate fields in a
    form. It checks to see whether the required fields are full, writes some mail headers and sends it.
    When I check to see if the code works, I get this error: QUOTE(affliates.cmat) Parse error:
    parse error, unexpected $ in /home/cmatcme/public_html/affliates.cmat on line 203 The
    funny thing is that regardelss of how long I make the file, the file always appear on the final
    line, whether I leave it blank or just put ?> . I understand that these errors ca....

    1. Looking for unexpected

Searching Video's for unexpected
advertisement



Unexpected $ - what does it mean



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE