Jump to content

[SOLVED] Trying to script for 2 different outcomes


Leveecius

Recommended Posts

Hey guys, right now I'm trying to make it so that on my game where it shows your ranks, it will show your ranks by your user level in the game (moderator, administrator, ect).  So, I've been trying and here is what I've got and I'm not so so sure if it's right or not:

 

<tr>
  <td width="150" height="18" bgcolor="#000066" class="menu_header2"><div align="center"><span class="style1"><strong>.::</strong>Rank<strong>::.</strong></span></div></td>
  </tr>
   <?
    if ($userlevel=1)
     echo'
    <td bgcolor="#333333"><div align="center"><? echo $rows['rank'];</td>' ?> <br>
    if ($userlevel >=2)
     echo'
    <td bgcolor="#333333"><div align="center"><? echo $rows['rank2'];<td>' ?> <br>
<br>
  <br>  
</div></td>
  </tr>

close  it's double equals and you need opening and closing braces and instead of closing the php you just need to concatenate and your quotes needed to be redon.

<tr>

  <td width="150" height="18" bgcolor="#000066" class="menu_header2"><div align="center"><span class="style1"><strong>.::</strong>Rank<strong>::.</strong></span></div></td>

  </tr>

  <?

    if ($userlevel==1)

    {

    echo "<td bgcolor='#333333'><div align='center'>".$rows['rank']."</td><br>";

    }

    if ($userlevel >=2)

    {

    echo "<td bgcolor='#333333'><div align='center'>".$rows['rank2']."<td><br>";

      }

    ?>

<br>

  <br>

</div></td>

  </tr>

Try this:

 

<tr>
  <td width="150" height="18" bgcolor="#000066" class="menu_header2"><div align="center"><span class="style1"><strong>.::</strong>Rank<strong>::.</strong></span></div></td>
  </tr>
  
   <?php 
    if($userlevel == 1) {
    $rank1 = $rows['rank'];
?>
    <td bgcolor="#333333"><div align="center"><?php echo $rank1; ?></td> <br>
<?php
}
    if ($userlevel >= 2) {
$rank2 = $rows['rank2'];
?>
    <td bgcolor="#333333"><div align="center"><?php echo $rank2; ?><td> <br>
<?php
}
?>
<br>
  <br> 
</div></td>
  </tr>

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.