<?php
include 'conexao.php';

$sql = "select * from bolsao order by ano desc";
$res = mysqli_query($conexao, $sql);
?>
<!DOCTYPE html>
<html lang="pt-BR">
    <head>

        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
        <meta name="description" content="Administração do Bolsão Força Máxima">
        <meta name="author" content="Vinícius">
        <!--    <link rel="icon" href="../../favicon.ico">-->

        <title>Administração do Bolsão 2017</title>
        <link rel="icon" href="../images/favicon.ico" >

        <!-- Bootstrap core CSS -->
        <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
        <link href="../css/bootstrap.css" rel="stylesheet">
        <link href="../css/bootstrap-theme.min.css" rel="stylesheet">
        <link href="../css/bootstrap.min.css" rel="stylesheet">



        <!-- IE10 viewport hack for Surface/desktop Windows 8 bug 
        <link href="../../assets/css/ie10-viewport-bug-workaround.css" rel="stylesheet">-->

        <!-- Custom styles for this template -->
        <link href="../css/main.css" rel="stylesheet">
        <link href="../style.css" rel="stylesheet">
        <script  language="javascript" type="text/javascript" src="../js/jquery-1.7.1.min.js"></script>
        <script  language="javascript" type="text/javascript" src="../js/main.js"></script>
        <script  language="javascript" type="text/javascript" src="../js/bootstrap.js"></script>


    </head>

    <body>
        <br>
        <div class="container">
            <div id="cadastro">
               <a href="novoBolsao.php?id="id="novoCadastroBolsao" >
               
                    <button class="btn btn-primary"><img src="../images/add.png" width="20" height="20">&nbsp&nbsp  Novo cadastro &nbsp&nbsp</button>
                </a>
            </div>
            <br>
            <div class="table-responsive table-hover">
                <table class="table">
                    <th>Descrição</th>
                    <th>Início Inscrição</th>
                    <th>Fim Inscrição</th>
                    <th>Dt. Prova</th>
                    <th></th>

                    <?php
                    while ($row = mysqli_fetch_array($res)) {
                        ?>
                        <tr>
                            <td><?php echo $row['descricao'] ?></td>
                            <td><?php echo date('d/m/Y', strtotime($row['data_inicio_inscricao'])); ?></td>
                            <td><?php echo date('d/m/Y', strtotime($row['data_fim_inscricao'])); ?></td>
                            <td><?php echo date('d/m/Y', strtotime($row['data_prova'])); ?></td>
                            <td><a href="novoBolsao.php?id=<?php echo $row['id']; ?>" target="_self">
                                    <button type="submit" class="btn btn-success"><img src="../images/ver.png" width="20" height="10">&nbsp&nbsp  Visualizar &nbsp&nbsp</button>
                                </a></td>

                        </tr>
                        <?php
                        next($row);
                    }
                    ?>
                </table>
            </div>
        </div>
    </body>
</html>