Data display does not work

Asked

Viewed 18 times

0

I need to display records coming from the bank, I’m doing this through a while and inserting each field into a td, but if I don’t limit the number of records in the select itself, they’re all on the same line (td). Follow the code below:

$select  = "SELECT descricao, nome, datahora_final, valor, tipo_valor FROM teste limit 1";  
$hoje    = date('Y-m-d');
$result  = mysqli_query($conexao, $select);
while($exibe = mysqli_fetch_assoc($result)){ 
     echo '<td>' . $exibe['descricao']      . '</td>';
     echo '<td>' . $exibe['nome']        . '</td>';
     echo '<td>' . $exibe['datahora_final'] . '</td>';
     echo '<td>' . $exibe['valor']          . '</td>';
}     
mysqli_free_result($result);

If anyone has a suggestion how to resolve, I’d appreciate it now!

1 answer

0


Hello, this is just a matter of logic.

try to add the tag tr

$select  = "SELECT descricao, nome, datahora_final, valor, tipo_valor FROM teste";  
$hoje    = date('Y-m-d');
$result  = mysqli_query($conexao, $select);
while($exibe = mysqli_fetch_assoc($result)){ 
     echo '<tr>';
       echo '<td>' . $exibe['descricao']      . '</td>';
       echo '<td>' . $exibe['nome']        . '</td>';
       echo '<td>' . $exibe['datahora_final'] . '</td>';
       echo '<td>' . $exibe['valor']          . '</td>';
     echo '</tr>';
}     
mysqli_free_result($result);
  • 1

    It really was just that, thank you!

  • thank you, you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.