-1
Save people, I’m trying to fill a table with data coming directly from the database (Mysql). I’m new to the web, I managed to put together a sketch of what I’m trying to do. If anyone can give 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>
That part of the table and the bank.
Good afternoon, what’s the mistake?
– arllondias
at first on these lines are speaking the
echo
.<td><?php echo $email ?></td>
 <td><?php echo $senha ?></td>
– arllondias
At first I thought that leaving this <tr> </tr> part inside the WHILE, the lines would be filled in, but not filled in. In the best case I had, only the first row was created and filled.
– Pierry Rodrigues
I added an image of the return that the code generates.
– Pierry Rodrigues
My friend, the data is below, the problem is in the closing of your tags
html
..thetbody
must be outside thewhile
and the closing of tags also, within thewhile
should be just the<tr>
and<td>
– arllondias
I added it as an answer, just to help you
– arllondias