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 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. 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>]' : ""; 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 Link to comment https://forums.phpfreaks.com/topic/67638-solved-ternary-operator-syntax/#findComment-339774 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.