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>

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.