unemployment Posted June 8, 2011 Share Posted June 8, 2011 Why is this not proper syntax $s = '<a href=\"../u/' echo $r['feedusername'];'\">' Quote Link to comment https://forums.phpfreaks.com/topic/238784-php-syntax-error/ Share on other sites More sharing options...
Pikachu2000 Posted June 8, 2011 Share Posted June 8, 2011 You need to terminate the variable assignment with a semicolon before continuing on to echo anything. If you're trying to assign the value of $r['feedusername'] as well, you need the concatenation operator, not echo. Quote Link to comment https://forums.phpfreaks.com/topic/238784-php-syntax-error/#findComment-1226953 Share on other sites More sharing options...
KevinM1 Posted June 8, 2011 Share Posted June 8, 2011 Because it's not? You have two options - use double quotes and have the variable value automatically substituted for you, like: $s = "<a href='../u/{$r['feedusername']}'>"; Or use single quotes and concatenation: $s = '<a href="../u/' . $r['feedusername'] . '">'; Quote Link to comment https://forums.phpfreaks.com/topic/238784-php-syntax-error/#findComment-1226957 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.