Fill in the table with bank data. (Mysql and Bootstrap 4.1)

-2

Save folks, I'm trying to populate a table with data coming directly from the database (Mysql). I'm new to the web, I've been able to put together an outline of what I'm trying to do. If anyone can give you some tips, I would be extremely grateful.

<?php 
include "conexao.php" ;
$sql = "Select * from usuario";
$resultado = mysqli_query($con,$sql); ?>

 <table class="table">
  <thead class="thead-dark">
    <tr>
      <th scope="col">#</th>
      <th scope="col">email</th>
      <th scope="col">senha</th>
     
    </tr>
  </thead>

<?php 
while($dados = mysqli_fetch_array($resultado)){
  $email = $dados['email'];
  $senha = $dados['senha']; ?>
 
  <tbody>
    <tr>
      <th scope="row"></th>
      <td><?php $email ?></td>
      <td><?php $senha ?></td>
     
    </tr> 
      </tbody>
</table>
  
   <?php } ?>

  </div>

This is the section about the table and the bank.

    
asked by anonymous 27.07.2018 / 21:11

1 answer

0

My friend, the data is below, the problem is when closing your tags html .. the tbody must be outside the while and the closing of the tags too, inside while should be only the <tr> and <td>

 <table class="table">
  <thead class="thead-dark">
    <tr>
      <th scope="col">#</th>
      <th scope="col">email</th>
      <th scope="col">senha</th>

    </tr>
  </thead>
<tbody>
<?php 
while($dados = mysqli_fetch_array($resultado)){
  $email = $dados['email'];
  $senha = $dados['senha']; ?>
 <tr>
      <th scope="row"></th>
      <td><?php $email ?></td>
      <td><?php $senha ?></td>

    </tr> 
 <?php } ?>
 </tbody>
</table>
  </div>
    
27.07.2018 / 22:13