flyersman Posted December 17, 2008 Share Posted December 17, 2008 Hey Guys. Here is my current code. <? global $session_user_id; $result = mysql_query("SELECT aff FROM users where users.id='$session_user_id'"); $row = mysql_fetch_assoc($result); if ( $row['aff'] == 0 ) { ?> <h3 class="padBtm">affiliate manager</h3><p>Your Affiliate Manager: <b>Jake</b></p><p>E-mail: <a href="mailto:[email protected]" class="redclr">[email protected]</a></p><p>AIM:<img src="http://big.oscar.aol.com/ExpressRevenue?on_url=http://expressrevenue.com/images/onine.gif&off_url=http://expressrevenue.com/images/off.gif"><a href="aim:goim?screenname=ExpressRevenue&message=Hello+Are+you+there?" class="redclr">Express Revenue</a><p>Phone: <b>1-877-943-4968 ext. 502</b></p><? } else { ?> <h3 class="padBtm">affiliate manager</h3> <p>Your Affiliate Manager: <b>Mike J.</b></p> <p>E-mail:<a href="mailto:[email protected]" class="redclr">[email protected]</a></p> <p>AIM:<img src="http://big.oscar.aol.com/ExpressRevMike?on_url=http://expressrevenue.com/images/onine.gif&off_url=http://expressrevenue.com/images/off.gif"> <a href="aim:goim?screenname=ExpressRevMike&message=" class="redclr">ExpressRevMike</a></p> <p>Phone: <b>1-877-943-4968 ext. 501</b></p> <? } ?> but I need to add a third one. So if i want the Jake one to show if aff = 0, mike to show if aff =1, and a new one to show if aff=2. How would I do that? Thanks! Link to comment https://forums.phpfreaks.com/topic/137296-need-simple-if-and-else-help-quick/ Share on other sites More sharing options...
trq Posted December 17, 2008 Share Posted December 17, 2008 ifelse. Link to comment https://forums.phpfreaks.com/topic/137296-need-simple-if-and-else-help-quick/#findComment-717357 Share on other sites More sharing options...
fooDigi Posted December 17, 2008 Share Posted December 17, 2008 it may be more proper to use a switch for branching your code... switch($row['aff']) { case 0: // code for jake break; case 1: // code for mike break; case 2: // code for "new" break; default: // for an input you may not have expected. } Link to comment https://forums.phpfreaks.com/topic/137296-need-simple-if-and-else-help-quick/#findComment-717366 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.