almightyegg Posted November 6, 2006 Share Posted November 6, 2006 [code=php:0] echo "<a href=http://www.lordoftheabyss.com/player/view.php?id=$player[id]>stripslashes($r['username'])</a>"; ?>[/code]i get this error ???[quote]Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/lordofth/public_html/forum/viewthread.php on line 154[/quote]is it to do with the stripslashes?? Link to comment https://forums.phpfreaks.com/topic/26358-whats-wrong-with-this-resolved/ Share on other sites More sharing options...
Caesar Posted November 6, 2006 Share Posted November 6, 2006 Try...[CODE]<?php $pname = stripslashes($r['username']); echo "<a href=http://www.lordoftheabyss.com/player/view.php?id=$player[id]>$pname</a>";?>[/CODE] Link to comment https://forums.phpfreaks.com/topic/26358-whats-wrong-with-this-resolved/#findComment-120521 Share on other sites More sharing options...
xtentic Posted November 6, 2006 Share Posted November 6, 2006 HiSecond post :PThis is better[code]<?phpecho "<a href=\"http://www.lordoftheabyss.com/player/view.php?id=" . $player[id] . "\">" . stripslashes($r['username']) . "</a>"; ?>[/code]You cannot include code in an echo without using end quots or " (sorry don't know the right word).So the upper example would be correct... (think so) Link to comment https://forums.phpfreaks.com/topic/26358-whats-wrong-with-this-resolved/#findComment-120522 Share on other sites More sharing options...
almightyegg Posted November 6, 2006 Author Share Posted November 6, 2006 cheers it works :) (i tried both ways and both worked :D) Link to comment https://forums.phpfreaks.com/topic/26358-whats-wrong-with-this-resolved/#findComment-120527 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.