...

View Full Version : parse error



otis_driftwood
03-13-2007, 04:19 PM
Parse error: syntax error, unexpected $end in /home/nakitaki/public_html/drug-game/tru/gp/html.php on line 211


209. <?
210. }
211. ?>

thanks otis:thumbsup:

CFMaBiSmAd
03-13-2007, 04:37 PM
This error is a PHP parser error, not a mysql error.

The unexpected $end error is normally caused by a mismatch in the number of opening and closing braces - { }

The way to correct this error is to proof read your code and make sure that there are matching { and }.

guelphdad
03-13-2007, 07:18 PM
also note that <? is deprecated, you should be using <?php

Inigoesdr
03-13-2007, 11:06 PM
also note that <? is deprecated
No it's not... as long as short tags are on in the php.ini you can use it just fine. And they're on by default.

CFMaBiSmAd
03-14-2007, 12:18 AM
If you are writing serious code that will be distributed or that will be used in conjunction with xml in the same file (the xml tag starts with the same <?), you should not use the short open tag. From the comments in the php.ini -


; NOTE: Using short tags should be avoided when developing applications or
; libraries that are meant for redistribution, or deployment on PHP
; servers which are not under your control, because short tags may not
; be supported on the target server. For portable, redistributable code,
; be sure not to use short tags.

Fou-Lu
03-14-2007, 01:22 AM
Short tags are theoretically not deprecated. I came to this conclusion by noticing that the default setting in php is on. However, I completely agree with the disabling of the shorttags to remain not only standards compliant but to also remain 100% portable with various platform settings.

Anyway, your code has some serious flaws. You cannot just enter sets of numbes into php code. Assuming that you are attempting to match the php closing brace, you need to output the value of the number using an echo or print function.

_Aerospace_Eng_
03-14-2007, 01:36 AM
Short tags are theoretically not deprecated. I came to this conclusion by noticing that the default setting in php is on. However, I completely agree with the disabling of the shorttags to remain not only standards compliant but to also remain 100% portable with various platform settings.

Anyway, your code has some serious flaws. You cannot just enter sets of numbes into php code. Assuming that you are attempting to match the php closing brace, you need to output the value of the number using an echo or print function.

I think they are just copying and pasting the code and the line numbers transferred over or they put them there. I don't think its actually in the php.

Fou-Lu
03-14-2007, 02:56 AM
o.O
I should pay more attention to what is actually there, instead of thinking of it just as an integer. I fail. Lol

aedrin
03-14-2007, 03:59 PM
Short tags are theoretically not deprecated. I came to this conclusion by noticing that the default setting in php is on. However, I completely agree with the disabling of the shorttags to remain not only standards compliant but to also remain 100% portable with various platform settings.

I think they left the default to On to keep older PHP code working. And shouldn't be taken as an indication of whether or not it is deprecated.

JohnDubya
03-14-2007, 04:27 PM
Parse error: syntax error, unexpected $end in /home/nakitaki/public_html/drug-game/tru/gp/html.php on line 211

Otis, I do this all the time. A couple things I've found helpful: use braces on their own line. This helps keep the code organized, and it's easier to see if you used the braces or not:


//do this
if (condition === true)
{
$do = this;
}

//instead of this
if (condition === true) {
$do = this;
}

The former takes up more space, but it's easier to see if you missed a brace. The second saves space and is a bit harder to check for missing braces. Neither is right or wrong...they have their positives and negatives.

Secondly, I sometimes use comments after ending braces to remind myself of what they close. For instance:


if (condition === true)
{
$do = this;
} //end of if condition is exactly true

Just some ideas. Good luck! :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum