Phpfr3ak Posted January 13, 2012 Share Posted January 13, 2012 Getting an unexpected end error on this and unsure as to why. <?php if($players['is_banned'] == 1) { ?> <a href="profile.php?id=<?php echo $players['id'] ?>"><?php echo $players['name'] ?> (BANNED) <? }else{ ?> <a href="profile.php?id=<?php echo $players['id'] ?>"><?php echo $players['name'] ?> <? } ?> Quote Link to comment Share on other sites More sharing options...
Muddy_Funster Posted January 13, 2012 Share Posted January 13, 2012 your not terminating your lines with semi-colons Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted January 13, 2012 Share Posted January 13, 2012 Actually, you don't need ; right before a closing ?> tag. Your unexpected $end error is probably because you are using short open tags and they are not enabled on your server. Be constant and always use full opening <?php tags in your code so that your code will always be seen as being php code. Why are you using so many opening and closing php tags in your code? <?php if($players['is_banned'] == 1) { echo "<a href='profile.php?id={$players['id']}'>{$players['name']} (BANNED)</a>"; }else{ echo "<a href='profile.php?id={$players['id']}'>{$players['name']}</a>"; } Or even simpler - <?php echo "<a href='profile.php?id={$players['id']}'>{$players['name']} ",($players['is_banned'] == 1) ? '(BANNED)' : '',"</a>"; Quote Link to comment Share on other sites More sharing options...
Phpfr3ak Posted January 13, 2012 Author Share Posted January 13, 2012 Thanks, went with the first option as wanted to remove the url with it, so you cannot click a banned players name, helped a bunch and fixed, Thanks guys. Quote Link to comment 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.