<?php 
    
    if(isset($_POST['search'])) { 
    $rankselect = $_POST['rankselect'];
    $i = 1;
    if($rankselect == 5) {
    	?>
        
            <div class="title-page" style="margin-bottom:15px;">BIG BOSSES</div>
        <table width="691" cellpadding="10" cellspacing="10" border="0">
      <tbody> 
        <tr>
          <td>Name</td>
            <td>Level</td>
          <td>Status</td>
        </tr>
        <?php
    	try { 
    $queryselectbig = "SELECT b.*,n.id, n.name,n.level FROM grandboss_data b LEFT JOIN npc n ON b.boss_id = n.id  ORDER BY n.name ASC"; 
    
    $querybossesbig = $db -> prepare($queryselectbig); 
    $querybossesbig -> execute(); 
    while ($resbossesbig = $querybossesbig -> fetch (PDO::FETCH_OBJ)) {
    	$respawnbig = $resbossesbig->respawn_time; 
    	$convertdatebig = date('d/m/Y H:i:s',($respawn->respawn_time / 1000));
    	?>
    	   <tr>
          <td><?php echo $resbossesbig-> name; ?></td>
          <td><?php echo $resbossesbig-> level; ?></td>
          <td>
    	  <?php if($resbossesbig->respawn_time == 0){
    echo "<div style='color:green' class='glyphicon glyphicon-ok'></div>";
    } else { echo $convertdatebig; }
     ?>
           </td>
        </tr>
        <?php
    
    }
    } catch (PDOException $e) {
    	echo $e->getMessage();
    }
    ?>
      </tbody>
    </table>
    
    
        <div class="title-page" style="margin-bottom:15px; clear:both; margin-top:15px;">RAID BOSSES</div>
        <table width="691" cellpadding="10" cellspacing="10" border="0">
      <tbody> 
        <tr>
          <td>Name</td>
            <td>Level</td>
          <td>Status</td>
        </tr>
        <?php
    $queryselectbosses = SELECT b.*,n.id, n.name,n.level FROM raidboss_spawnlist b LEFT JOIN npc n ON b.boss_id = n.id ORDER BY n.name ASC ; 
    
    $querybosses = $db -> prepare($queryselectbosses); 
    $querybosses -> execute(); 
    while ($resbosses = $querybosses -> fetch (PDO::FETCH_OBJ)) {
    	$respawn = $resbosses->respawn_time; 
    	$convertdate = date('d/m/Y H:i:s',($respawn->respawn_time / 1000));
    	?>
    	   <tr>
          <td><?php echo $resbosses-> name; ?></td>
          <td><?php echo $resbosses-> level; ?></td>
          <td>
    	  <?php if($resbosses->respawn_time == 0){
    echo "<div style='color:green' class='glyphicon glyphicon-ok'></div>";
    } else { echo $convertdate; }
     ?>
           </td>
        </tr>
        <?php
    }
    }
    }
    
    ?>
    
      </tbody>
    </table>