Monkuar Posted July 14, 2009 Share Posted July 14, 2009 if ($cur_post['group_id'] == '1') $user_info[] = '<br>Group'.': Admin'; else $user_info[] = '<br>Group'.': Members'; but i want to say IF ($cur_post['group_id'] == '2') then display something too? How do i do that Link to comment https://forums.phpfreaks.com/topic/165981-solved-else-if/ Share on other sites More sharing options...
Maq Posted July 14, 2009 Share Posted July 14, 2009 Just like you said, elseif. You can also use a switch. Link to comment https://forums.phpfreaks.com/topic/165981-solved-else-if/#findComment-875428 Share on other sites More sharing options...
Psycho Posted July 14, 2009 Share Posted July 14, 2009 if ($cur_post['group_id'] == '1') { $user_info[] = '<br>Group'.': Admin'; } else if ($cur_post['group_id'] == '2') { $user_info[] = '<br>Group'.': Members'; } However, if you are doing more than just two options, you should be using a switch() statement switch ($cur_post['group_id']) { case '1': $user_info[] = '<br>Group'.': Admin'; break; case '2': $user_info[] = '<br>Group'.': Members'; break; case '3': default: $user_info[] = '<br>Group'.': Somethign Else'; break; } Link to comment https://forums.phpfreaks.com/topic/165981-solved-else-if/#findComment-875434 Share on other sites More sharing options...
Monkuar Posted July 14, 2009 Author Share Posted July 14, 2009 thank u sir alot.. <3 Link to comment https://forums.phpfreaks.com/topic/165981-solved-else-if/#findComment-875440 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.