<div class="stats">

<?php
if ((isset($_SESSION['id'])) and (isset($_SESSION['nick'])))  {
$id = $_SESSION['id'];
?>
<div class="line"></div>
<table class="foot" width="100%" border="0" cellpadding="0" cellspacing="0" style="padding-top: 5px;">
<tbody>
<tr>
</tr><tr><td width="33%">
<a class="big-but" href="index.php">
<div class="imgwrap"><img src="http://sdark.mobi/images/icon/glav.png"></div><span>На главную</span></a>
</td><td width="33%">
<a class="big-but" href="me.php">
<div class="imgwrap"><img src="http://sdark.mobi/images/icon/user.png"></div><span>Персонаж</span></a>
</td>
</div> 

<div class="line"></div>
  <?php
  $query = "Select clan from users where id = '$id'";
  $result = mysqli_query($dbc, $query) or die ('Ошибка передачи запроса к БД'); 
  $row = mysqli_fetch_array($result);
  $clan = $row['clan'];
  if (!empty($clan)) {
    ?>
<td width="33%">
<a class="big-but" href="clan.php?id=<?php echo "$clan"; ?>">
<div class="imgwrap"><img width="15" height="15" src="http://sdark.mobi/images/main/tournament-grey.png"></div>
<span>Клан</span></a>
</td></tr><tr></tr>
</tbody></table>

    <?php
  }
}
?>