unemployment Posted March 31, 2011 Share Posted March 31, 2011 <?php echo if ($info['accounttype'] == 1) ? 'Entrepreneur' : 'Investor'; ?> Link to comment https://forums.phpfreaks.com/topic/232306-where-is-my-syntax-error/ Share on other sites More sharing options...
AbraCadaver Posted March 31, 2011 Share Posted March 31, 2011 You're trying to mix an if and the ternary. Use: echo ($info['accounttype'] == 1) ? 'Entrepreneur' : 'Investor'; Link to comment https://forums.phpfreaks.com/topic/232306-where-is-my-syntax-error/#findComment-1195041 Share on other sites More sharing options...
Maq Posted March 31, 2011 Share Posted March 31, 2011 For more information: http://us3.php.net/ternary - Example #2 Link to comment https://forums.phpfreaks.com/topic/232306-where-is-my-syntax-error/#findComment-1195061 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.