<?php 
include 'header.php';

?>

<!-- Card start -->
     <div class="card">
                  <div class="card-header">
                    <div class="card-title"></div>
                  </div>
                  <div class="card-body">
                    <div class="table-responsive">
                      <table id="scrollVertical" class="table custom-table">
                        <thead>
                          <tr>
                            <th>#</th>
                            <th>User</th>
                            <th>Plan</th>
                            <th>Coin</th>
                            <th>Amount</th>
                            <th>Total Return</th>
                            <th>Percent/Period</th>
                            <th>Start/End Date</th>
                            <th>Status</th>
                            <!-- <th>Action</th>
                            <th>Action</th> -->
                          </tr>
                        </thead>
                        <tbody>
                     <?php
                          $i = 0;
                            $select = mysqli_query($link, "SELECT stakes.status as stake_status, stakes.end_date, stakes.start_date, stakes.period, stakes.percent, stakes.total_profit, stakes.amount, stakes.coin, users.fname, users.email, stakes.plan FROM  stakes INNER JOIN users ON stakes.userId = users.id WHERE stakes.status = 'Active' ORDER BY stakes.id DESC ");
                              if (mysqli_num_rows($select) > 0) {
                                while ($row = mysqli_fetch_assoc($select)) {
                                 
                                  $i++         
                       ?>  
                          <tr>
                            <td><?php echo $i  ?></td>
                            <td><?php echo ucwords($row['fname'])  ?> / <br><?php echo $row['email']  ?></td>
                            <td><?php echo $row['plan']  ?></td>
                            <td><?php echo $row['coin']  ?></td>	
                            <td><?php echo $row['amount']?> USD</td>
                            <td><?php echo $row['total_profit']?> USD</td>
                            <td><?php echo $row['percent']?>% / <?php echo $row['period']?> days</td>
                            <td><?php echo $row['start_date'] ?> / <br> <?php echo $row['end_date'] ?></td>
                            <td><?php echo $row['stake_status'] ?></td>

                        </tr>
                    
                      <?php }} ?>
                      </tbody>
                  </table>
              </div>
          </div>
      </div>
  </div>
<?php
    include 'footer.php';
?>