<!-- <form action="uploadturnamen.php" method="post" enctype="multipart/form-data">
    <input type="file" name="turnamen" id="turnamen" />
    <button type="submit" name="upload">Submit</button>
</form> -->

<div class="container">
    <h3 class="text-center text-uppercase">Turnamen Turnover</h3>
    <hr class="w-75 d-block mx-auto">
        <div class="table-responsive">
                <table class="table text-center table-bordered table-light">
                    <thead class="table-warning">
                        <tr>
                            <th>No.</th>
                            <th>Username</th>
                            <th>Permainan</th>
                            <th>Turnover Yang dicapai</th>
                            <th>Tanggal</th>
                            <th>Status</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php 
                            $sturna = "SELECT * FROM peserta_to ORDER BY tanggal_to DESC";
                            $qturna = mysqli_query($data, $sturna);

                            if(mysqli_num_rows($qturna) > 0) {
                                $x = 1;
                                while($fturna = mysqli_fetch_assoc($qturna))  {
                                        $namauser = $fturna['nama_user'];
                                        $touser = $fturna['to_user'];
                                        $gameuser = $fturna['game_user'];
                                        $tgl = $fturna['tanggal_to'];

                                        $sto = "SELECT limit_to FROM web_setting";
                                        $qto = mysqli_query($data, $sto);
                                        $fto = mysqli_fetch_assoc($qto);
                                        $limitto = $fto['limit_to'];

                                        echo '<tr>
                                        <td>'.$x++.'.</td>
                                        <td>'.$namauser.'</td>
                                        <td class="text-uppercase">'.$gameuser.'</td>
                                        <td>'.$touser.'</td>
                                        <td>'.date("d-m-Y", strtotime($tgl)).'</td>
                                        ';
                                            if($touser >= $limitto) {
                                                echo '<td class="table-success"> <span class="fw-bold">TERCAPAI</span></td>';
                                                
                                            } else {
                                                echo '<td class="table-danger"> <span class="fw-bold">TIDAK TERCAPAI</span></td>';
                                            }
                                        
                                        
                                      echo'  
                                    </tr>';

                                }
                            }
                        
                        ?>

                    </tbody>
                </table>
        </div>

        <div class="my-3">
                    <?php echo ftab("turnamen_text", "change_text", "turnamen_text"); ?>
        </div>
</div>