runnerjp Posted February 20, 2007 Share Posted February 20, 2007 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 https://forums.phpfreaks.com/topic/39281-solved-parse-error-syntax-error-unexpected-t_string-can-any-1-help-please/ Share on other sites More sharing options...
Jessica Posted February 20, 2007 Share Posted February 20, 2007 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 https://forums.phpfreaks.com/topic/39281-solved-parse-error-syntax-error-unexpected-t_string-can-any-1-help-please/#findComment-189321 Share on other sites More sharing options...
runnerjp Posted February 20, 2007 Author Share Posted February 20, 2007 ahh that makes sence thanks Link to comment https://forums.phpfreaks.com/topic/39281-solved-parse-error-syntax-error-unexpected-t_string-can-any-1-help-please/#findComment-189322 Share on other sites More sharing options...
runnerjp Posted February 20, 2007 Author Share Posted February 20, 2007 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 https://forums.phpfreaks.com/topic/39281-solved-parse-error-syntax-error-unexpected-t_string-can-any-1-help-please/#findComment-189323 Share on other sites More sharing options...
Jessica Posted February 20, 2007 Share Posted February 20, 2007 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... Link to comment https://forums.phpfreaks.com/topic/39281-solved-parse-error-syntax-error-unexpected-t_string-can-any-1-help-please/#findComment-189325 Share on other sites More sharing options...
runnerjp Posted February 20, 2007 Author Share Posted February 20, 2007 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 https://forums.phpfreaks.com/topic/39281-solved-parse-error-syntax-error-unexpected-t_string-can-any-1-help-please/#findComment-189327 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.