Jump to content

[SOLVED] Parse error: syntax error, unexpected T_STRING - can any 1 help please


runnerjp

Recommended Posts

echo"Welcome Guest, please <a href="register.php">register</a>";

 

where have i gone wrong here because i keep getitng

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/runnerse/public_html/include/header.inc.php on line 27
and i cant figure out where they need to go :S

Whenever you want to use quotes inside a string which is opened with those quotes, you must escape them.

 

Invalid:

print 'This isn't "that" bad!';

print "She said "Hi", didn't she?";

 

Valid:

print 'This isn\'t "that" bad!';

print "She said \"Hi\", didn't she?";

 

 

You have to tell PHP that you mean the character " or ', and not the end of the string.

For yours you should do:

echo 'Welcome Guest, please <a href="register.php">register</a>';

Since there are no variables in it.

ok this whole code seems to be wrong lol coulkd u have qucik check for me if thats ok ??

 

<?
if($auth[displayname] == "")// if the variable is empty execute the fallowing
{
echo'Welcome Guest, please <a href="register.php">register[/url]'
{
else
{
echo"Hey logged in as".$auth[displayname];
}
?>

The forum messed up my post - if you actually read what I posted instead of just copying and pasting, you might have noticed that and figured that your code shouldn't say [/url] in it...

oh yer sorry but now im gtting the case of

Parse error: syntax error, unexpected T_ELSE in /home/runnerse/public_html/include/header.inc.php on line 29
which does not make sence to me as all i have there is else which i need because it shows if the user is not logged in i will need this to happen :S here is updated code

 

<?
if($auth[displayname] == "")// if the variable is empty execute the fallowing
{
echo'Welcome Guest, please <a href="register.php">register';
{
else
{
echo"Hey logged in as".$auth[displayname];
}
?>

( btw i did read the post and i under stood it just got confused when it had [/url] at end lol and thought i would add it when it didnt work 1st time lol

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

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.