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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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];
}
?>

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.