graham23s Posted September 2, 2007 Share Posted September 2, 2007 Hi Guys, this code is giving me a T_ECHO error can anyone look at the syntax for me code: $is_this_admin = ($admin == 'Site Administrator') ? echo '[<a class="altlink" href="edit.php?id='.$id.'&editedby='.$upper.'"><b>EDIT</b></a>]-[<a class="altlink" href="delete.php?id='.$id.'"><b>DELETE</b></a>]'; : echo ""; am i allowed to have an echo in this type of function at all? thanks guys Graham Quote Link to comment https://forums.phpfreaks.com/topic/67638-solved-ternary-operator-syntax/ Share on other sites More sharing options...
wildteen88 Posted September 2, 2007 Share Posted September 2, 2007 You don't use echo when define variables. Just remove the echo's and your code will work. Quote Link to comment https://forums.phpfreaks.com/topic/67638-solved-ternary-operator-syntax/#findComment-339769 Share on other sites More sharing options...
sasa Posted September 2, 2007 Share Posted September 2, 2007 try echo $is_this_admin = ($admin == 'Site Administrator') ? '[<a class="altlink" href="edit.php?id='.$id.'&editedby='.$upper.'"><b>EDIT</b></a>]-[<a class="altlink" href="delete.php?id='.$id.'"><b>DELETE</b></a>]' : ""; Quote Link to comment https://forums.phpfreaks.com/topic/67638-solved-ternary-operator-syntax/#findComment-339772 Share on other sites More sharing options...
graham23s Posted September 2, 2007 Author Share Posted September 2, 2007 Thanks a lot to both of you guys it works great now. Graham Quote Link to comment https://forums.phpfreaks.com/topic/67638-solved-ternary-operator-syntax/#findComment-339774 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.