Jump to content

Need simple if and else help quick!


flyersman

Recommended Posts

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

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.
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.