EchoFool Posted February 19, 2008 Share Posted February 19, 2008 I have a syntax error on a string im building using variables.. not sure how its meant to be done properly... this is the line: <?php $QuoteLine = '<div class='quotetop'>QUOTE</div><div class='quotemain'>'.$QuoteUsername.'<br>'.$QuoteMessage.'</div>'; ?> Parse error: syntax error, unexpected T_STRING on line 486 How is it meant to be ? Hope you can help Link to comment https://forums.phpfreaks.com/topic/91931-syntax-help/ Share on other sites More sharing options...
craygo Posted February 19, 2008 Share Posted February 19, 2008 you have to escape the single quotes. $QuoteLine = '<div class=\'quotetop\'>QUOTE</div><div class=\'quotemain\'>'.$QuoteUsername.'<br>'.$QuoteMessage.'</div>'; or use double inside the single $QuoteLine = '<div class="quotetop">QUOTE</div><div class="quotemain">'.$QuoteUsername.'<br>'.$QuoteMessage.'</div>'; Ray Link to comment https://forums.phpfreaks.com/topic/91931-syntax-help/#findComment-470745 Share on other sites More sharing options...
revraz Posted February 19, 2008 Share Posted February 19, 2008 Use double quotes around the entire string instead of single. Link to comment https://forums.phpfreaks.com/topic/91931-syntax-help/#findComment-470746 Share on other sites More sharing options...
duclet Posted February 19, 2008 Share Posted February 19, 2008 Since you do have string replacement within the string, you are better off using the double quotes. <?php $QuoteLine = "<div class='quotetop'>QUOTE</div><div class='quotemain'>$QuoteUsername<br />$QuoteMessage</div>"; ?> Link to comment https://forums.phpfreaks.com/topic/91931-syntax-help/#findComment-470767 Share on other sites More sharing options...
EchoFool Posted February 19, 2008 Author Share Posted February 19, 2008 Well i made life slightly easier for myself using a BB function so now i put: $QuoteLine = '[quote]'.$QuoteUsername.'<br>'.$QuoteMessage.'[/quote]''; But it's not liking that either.. do i have to escape / symbol on the ? Link to comment https://forums.phpfreaks.com/topic/91931-syntax-help/#findComment-470768 Share on other sites More sharing options...
revraz Posted February 19, 2008 Share Posted February 19, 2008 You have an extra single quote at the end. Link to comment https://forums.phpfreaks.com/topic/91931-syntax-help/#findComment-470769 Share on other sites More sharing options...
EchoFool Posted February 19, 2008 Author Share Posted February 19, 2008 Good spot! Thanks everyone SOLVED Link to comment https://forums.phpfreaks.com/topic/91931-syntax-help/#findComment-470796 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.