unemployment Posted March 31, 2011 Share Posted March 31, 2011 <?php echo if ($info['accounttype'] == 1) ? 'Entrepreneur' : 'Investor'; ?> Quote 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'; Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.